On Feb 1, 2010, at 3:58 AM, Stuart Malin wrote:
> My code worked fine with NSString's +stringWithCString:length: even though
> the string was not NULL terminated.
Ah, you're right, I'd forgotten that method. It doesn't look for a NUL
terminator because the length is given explicitly.
You st
On Jan 31, 2010, at 9:49 PM, Kyle Sluder wrote:
> On Sun, Jan 31, 2010 at 6:28 PM, Stuart Malin wrote:
>> If I use +dataWithBytes:length: then I need to specify a length 1 greater,
>> and that additional byte must be set to 0 (to null terminate the string).
>> So, I could use NSMutableData, th
On Jan 31, 2010, at 9:53 PM, Jens Alfke wrote:
> No. You don't want to pass a null terminated string to anything but the
> methods that explicitly take a C string. Anything else just wants the
> characters, with no nulls.
>
> --Jens {via iPhone}
NSString's +stringWithCString:encoding: does
No. You don't want to pass a null terminated string to anything but
the methods that explicitly take a C string. Anything else just wants
the characters, with no nulls.
--Jens {via iPhone}
On Jan 31, 2010, at 6:28 PM, Stuart Malin wrote:
On Jan 31, 2010, at 9:12 PM, Kyle Sluder wrote:
On Sun, Jan 31, 2010 at 6:28 PM, Stuart Malin wrote:
> If I use +dataWithBytes:length: then I need to specify a length 1 greater,
> and that additional byte must be set to 0 (to null terminate the string). So,
> I could use NSMutableData, then -resetBytesInRange: to zero out the last
> byte, wh
On Jan 31, 2010, at 9:12 PM, Kyle Sluder wrote:
> On Sun, Jan 31, 2010 at 5:51 PM, Stuart Malin wrote:
>> I acquire a password from a keychain using SecKeychainFindGenericPassword.
>> That provides a non null terminated c string and a length. I had been using
>> [NSString stringWithCString: le
On Sun, Jan 31, 2010 at 7:51 PM, Stuart Malin wrote:
> I acquire a password from a keychain using SecKeychainFindGenericPassword.
> That provides a non null terminated c string and a length. I had been using
> [NSString stringWithCString: length:] to get an NSString instance of the
> password.
On Sun, Jan 31, 2010 at 5:51 PM, Stuart Malin wrote:
> I acquire a password from a keychain using SecKeychainFindGenericPassword.
> That provides a non null terminated c string and a length. I had been using
> [NSString stringWithCString: length:] to get an NSString instance of the
> password.