• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString to char[]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString to char[]


  • Subject: Re: NSString to char[]
  • From: Clark Cox <email@hidden>
  • Date: Fri, 29 Jul 2005 09:34:21 -0400

2005/7/24, Jerry Brace <email@hidden>:
> Hey Guys,
>
> I found a solution that works - let me know what you think:
>
>      NSMutableString * path = [thisBundle pathForResource:@"wakein"
> ofType:@""];
>
>      unsigned int lengthOfMessage = [path length];
>      char sysctlPath[lengthOfMessage + 1];
>      strcpy(sysctlPath, [path UTF8String]);

Bad idea. (strlen([path UTF8String])) does not always equal ([path
length]). Try this instead:

const char *sysctlPath = [path fileSystemRepresentation];

--
Clark S. Cox III
email@hidden
http://clarkcox3.livejournal.com/
http://homepage.mac.com/clarkcox3/
 _______________________________________________
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

  • Follow-Ups:
    • Re: NSString to char[]
      • From: pjl <email@hidden>
References: 
 >NSString to char[] (From: Jerry Brace <email@hidden>)
 >Re: NSString to char[] (From: j o a r <email@hidden>)
 >Re: NSString to char[] (From: Jerry Brace <email@hidden>)
 >Re: NSString to char[] (From: John Stiles <email@hidden>)
 >Re: NSString to char[] (From: Jerry Brace <email@hidden>)

  • Prev by Date: Re: Running remote commands through sudo/sec framework?
  • Next by Date: Re: Wrapping Command Line Tools
  • Previous by thread: Re: NSString to char[]
  • Next by thread: Re: NSString to char[]
  • Index(es):
    • Date
    • Thread