FROM : Tran Kim Bach
DATE : Wed Jun 25 08:19:23 2008
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.
DATE : Wed Jun 25 08:19:23 2008
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 mail archive

