RE: Pascal String Woes ...
RE: Pascal String Woes ...
- Subject: RE: Pascal String Woes ...
- From: "Josh Ferguson" <email@hidden>
- Date: Wed, 11 Feb 2004 15:02:38 -0600
- Thread-topic: Pascal String Woes ...
J,
You're only creating a pointer, not actually allocating any space. If all you need is 255 characters, try the following:
NSString * strA = [preferences objectForKey:@"contentsa"];
NSString * strB = [preferences objectForKey:@"contentsb"];
Str255 pStrA;
Str255 pStrB;
CFStringGetPascalString((CFStringRef) strA, pStrA, 256, kCFStringEncodingASCII); // DIES HERE
CFStringGetPascalString((CFStringRef) strB, pStrB, 256, kCFStringEncodingASCII);
-----Original Message-----
From: email@hidden
[
mailto:email@hidden]On Behalf Of J Nozzi
Sent: Wednesday, February 11, 2004 2:35 PM
To: Cocoa Forum
Subject: Pascal String Woes ...
List:
Okay, I admit that my standard C knowledge is severely lacking here.
I've been *meaning* to read the $50 books I bought, really I have. ;-)
In the mean time, the following code dies at the indicated line (//
DIES HERE) with a SIGSEGV / EXEC_BAD_ACCESS.
NSString * strA = [preferences objectForKey:@"contentsa"];
NSString * strB = [preferences objectForKey:@"contentsb"];
StringPtr strAPtr;
StringPtr strBPtr;
CFStringGetPascalString((CFStringRef) strA, strAPtr, 256,
kCFStringEncodingASCII); // DIES HERE
CFStringGetPascalString((CFStringRef) strB, strBPtr, 256,
kCFStringEncodingASCII);
... any takers?
- J
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.