• 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: NSTask output and input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask output and input


  • Subject: Re: NSTask output and input
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Wed, 19 Jan 2005 14:31:14 +0100

At 14:20 Uhr -0800 18.01.2005, Mai Bui wrote:
I have one application using NSTask to call another my application, now I want this application also:

If your other app is (or should be) a GUI app, listen to what John wrote. NSTask is not good for GUI apps, and you shouldn't just display a command-line app's data in a fake console window. If you do that, your users might as well launch it from the command line themselves.


1. Printout on the NSTextView window the display strings from the other my app(use printf) in real time not wait for to the end of the called app. (because my app run in loop)

You have to read in background. See NSFileHandle.h

2. Get input from the user and send to my app because my app need to get input from user to stop (i.e: "s" character).

Just send the text into the NSTask's stdin. If you don't know this, be sure to learn about Unix pipes and Unix processes. This works the same way on all Unixes, not just MacOS X.


BTW -- there's a really good tutorial about NSTask out on the web. I think it was at http://www.cocoadevcentral.com, but it may also have been at O'Reilly's MacDevCenter.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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
  • Follow-Ups:
    • Re: NSTask output and input
      • From: Mai Bui <email@hidden>
References: 
 >NSTask output and input (From: Mai Bui <email@hidden>)

  • Prev by Date: Re: NSSplitView Messing Up Custom Views
  • Next by Date: Re: Dynamic menu for document-based app?
  • Previous by thread: Re: NSTask output and input - Related question
  • Next by thread: Re: NSTask output and input
  • Index(es):
    • Date
    • Thread