Re: A problematic combination of malloc and getCharacters.
Re: A problematic combination of malloc and getCharacters.
- Subject: Re: A problematic combination of malloc and getCharacters.
- From: "stephen joseph butler" <email@hidden>
- Date: Wed, 24 Oct 2007 18:09:00 -0500
On 10/24/07, deepak gopal <email@hidden> wrote:
> 1 - (BOOL)performChange {
> 2 char **plistArgs = (char **) malloc(3 *sizeof(char*));
> 3 NSString *shell = @"/bin/sh";
>
> 4 char *plistScript = (char *) malloc([copyPlistScript_ length]*sizeof(unichar));
> 5 [copyPlistScript_ getCharacters:(unichar *) plistScript];
>
> 6 char *garage = (char *) malloc([garage_ lengthOfBytesUsingEncoding:NSUnicodeStringEncoding]);
> 7 [garage_ getCharacters:(unichar *) garage];
a) sizeof(unichar) != sizeof(char)
b) a unichar string is very different from a char string.
c) posix functions don't accept unichar's.
d) <http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/ManipulatingPaths.html#//apple_ref/doc/uid/20000152>
_______________________________________________
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