Newbie question: error in creating a NSData object using handle (Resource Management)
Newbie question: error in creating a NSData object using handle (Resource Management)
- Subject: Newbie question: error in creating a NSData object using handle (Resource Management)
- From: "Tran Kim Bach" <email@hidden>
- Date: Wed, 25 Jun 2008 15:19:23 +0900
Hi folks,I'm a newbie to Cocoa.
Recently, I'm working on a project relating to Resource Management.
In my project, there's a part that I'm reading through the resources in a
resource file.
I'm using:
int count = CountResources( typeName );
to get all resource that has the type "typeName", then loop through this
resource list to take resource data out.
for (n = 1; n <= count; n++)
{
Handle dataHandle = Get1IndResource( type1, n);
....
NSData *data = [NSData dataWithBytes: *dataHandle length:
GetResourceSizeOnDisk(dataHandle)]; // I GOT AN ERROR HERE
//using data
struct A_STRUCT aStruct;
memcpy(& aStruct,[data bytes], [data length]);
}
After several times looping through the list, I got an error in the line
above.
But if I use data directly, like the following code, there is no error
occurred.
memcpy(&pgControlRes,*dataHandle, GetResourceSizeOnDisk(dataHandle));
Any suggestions for my problem.
I highly appreciate all your helps.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden