• 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: printing the standard output in a NSTextview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >printing the standard output in a NSTextview (From: Martin Marier <email@hidden>)
 >Re: printing the standard output in a NSTextview (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Find app's working directory
  • Next by Date: Re: Advanced text-layout questions
  • Previous by thread: Re: [OT] "Cocoa in a Nutshell" is great!
  • Next by thread: Chicago Meeting Tuesday January 6th @ 6:00 PM
  • Index(es):
    • Date
    • Thread