• 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: Non-nil terminated C string to NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-nil terminated C string to NSString


  • Subject: Re: Non-nil terminated C string to NSString
  • From: Ken Tozier <email@hidden>
  • Date: Thu, 3 Aug 2006 03:12:47 -0400


On Aug 2, 2006, at 9:08 PM, John Stiles wrote:

Does initWithBytes:length:encoding: work for you?
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Classes/NSString_Class/Reference/Reference.html#//apple_ref/occ/ instm/NSString/initWithBytes:length:encoding:

There appears to be a bug though in the complementary NSString getCString:maxLength:encoding: method. It always replaces the first character with zero if you use "NSUTF8StringEncoding." Just something to be aware of if you need to get the strings back into C form.


I filed a bug report.

Ken
_______________________________________________
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


References: 
 >Non-nil terminated C string to NSString (From: Ben Phipps <email@hidden>)
 >Re: Non-nil terminated C string to NSString (From: John Stiles <email@hidden>)

  • Prev by Date: my print option
  • Next by Date: how to use mount volume with timeout argument in AppleScript.
  • Previous by thread: Re: Non-nil terminated C string to NSString
  • Next by thread: Re: Non-nil terminated C string to NSString
  • Index(es):
    • Date
    • Thread