Hi,
I'm tring to create an NSString object from data contained within a
file. The following code attempts to do this. The data is read from
the file OK and all the size information etc. is OK.
Here is a code snippet:
myOSStatus = [self ReadUInt32LEFromPosition: myCurrentFilePosition +
28 IntPtr:&myBufferSize];
myStringSize = (myBufferSize / 2) + 1;
myStringBufferPtr = malloc(myBufferSize + 2);
bzero(myStringBufferPtr,myBufferSize + 2);
myOSStatus = [self ReadFromPosition: myCurrentFilePosition + 40
ForSize: myBufferSize BufferPtr:myStringBufferPtr];
[thePropertiesInfoPtr->mNameString initWithCharacters:
myStringBufferPtr length:myStringSize];
---------------------
thePropertiesInfoPtr pointer to a C Structure that contains the
following member:
NSString* mNameString;
When the initWithCharacters method is called, the variables are setup
as follows:
myBufferSize = 54
myStringSize = 28
myStringBufferPtr is a pointer the following:
41 00 42 00 43 00 44 00 45 00 46 00 47 00 48 00
49 00 4A 00 4B 00 4C 00 4D 00 4D 00 4E 00 4F 00
50 00 51 00 52 00 53 00 54 00 55 00 56 00 57 00
58 00 59 00 5A 00 00 00
But I get an Access Error when I run it. Could someone tell me what I
am doing wrong and how I can correct it?
Thanks a lot
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]