Re: reading a text file
Re: reading a text file
- Subject: Re: reading a text file
- From: Tito Ciuro <email@hidden>
- Date: Sun, 18 May 2003 21:34:12 +0200
On domingo, mayo 18, 2003, at 18:17 Europe/Madrid, Marc Weil wrote:
>
NSString *newString = [NSString stringWithCString: [yourData bytes]];
>
>
That would be the way to convert an NSData object to an NSString
>
object.
>
>
-- Marc Weil
I wouldn't do that.
It's better if you use NSString's stringWithUTF8String instead:
NSString *newString = [NSString stringWithUTF8String:[yourData bytes]];
If you use stringWithCString, you'll skip international symbols, like
"q", accents, et al.
Regards,
-- Tito
>
On 5/17/03 9:47 PM, "Paul N. Schatz" <email@hidden> wrote:
>
>
> As part of a Cocoa program, I need to read a BBEdit file into
>
> a text field or string. Using 'contentsAtPath:', I get an NSData
>
> file of bytes, but I can't seem to subsequently convert that to text.
>
> Is there a way to do that, or is there a better way to do the whole
>
> thing?
>
>
>
> Paul
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.