Re: NSString to char[]
Re: NSString to char[]
- Subject: Re: NSString to char[]
- From: Jerry Brace <email@hidden>
- Date: Sun, 24 Jul 2005 14:39:42 -0230
I've tried UTF8String and I get the error : "invalid initializer"
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSMutableString * path = [thisBundle pathForResource:@"wakein"
ofType:@""];
AuthorizationRights rights;
AuthorizationRights *authorizedRights;
AuthorizationFlags flags;
AuthorizationItem items[1];
char sysctlPath[] = [path UTF8String];
Any ideas?
Jerry
On 24-Jul-05, at 2:35 PM, ObjM2 wrote:
Jerry Brace wrote:
I have a NSString set up like so:
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSString * path = [thisBundle pathForResource:@"wakein" ofType:@""];
Now I need to assign "path" to:
char sysctlPath[]
(it has to be a C string)
Any ideas?
cstring = [path lossyCString];
which is deprecated as of 10.4 though, so you'll probably want to use
cstring = [path UTF8String];
by the time 10.5 shows up.
rgds
___________________________________________________________ How
much free photo storage do you get? Store your holiday snaps for
FREE with Yahoo! Photos http://uk.photos.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden