Re: printing the standard output in a NSTextview
Re: printing the standard output in a NSTextview
- Subject: Re: printing the standard output in a NSTextview
- From: Douglas Davidson <email@hidden>
- Date: Mon, 5 Jan 2004 10:20:04 -0800
On Jan 4, 2004, at 8:20 PM, Nick Zitzmann wrote:
I'm trying to display the stdout of a shell command (whatever
command, I'm testing with ls) in a NSTextview. I can do the system
call with NSTask and pipe it into a NSData. How can I get the data
held in NSData to be displayed in my NSTextView ? Should I do a type
cast ? Or should I use a different type of NSView ?
NSString can convert NSData text data into a string. Try using it with
some encoding (probably ASCII) and inserting the string into the text
view. See the NSString documentation for details.
For BSD-level text, the appropriate encoding in most cases is UTF-8.
There are even convenience methods initWithUTF8String: and
stringWithUTF8String: to encourage you to use it. (For file names and
paths, use the appropriate NSFileManager methods.)
Douglas Davidson
_______________________________________________
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.