Re: Reading individual bytes from a string
Re: Reading individual bytes from a string
- Subject: Re: Reading individual bytes from a string
- From: Phil Faber <email@hidden>
- Date: Mon, 17 Apr 2006 19:20:38 +0100
On 17 Apr 2006, at 18:47, Nick Zitzmann wrote:
On Apr 17, 2006, at 11:02 AM, Phil Faber wrote:
// Place character 8 from the file into statusText - THIS
LINE FAILS!
[statusText setStringValue:[fileContents characterAtIndex:8]];
Assuming statusText is an NSTextField, you are trying to pass a
unichar into a method requiring an NSString. If fileContents is an
NSString, and you want a partial NSString, then you should use -
substringWithRange: and NSMakeRange() instead.
Thanks Nick. Newbie is very grateful! I've changed the above line
to read:
NSString *substring = [aString substringWithRange:NSMakeRange(8,1)];
..and it works great.
Phil
Send instant messages to your online friends http://uk.messenger.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