Creating an App that Creates a New Process

Unix systems have a program called sort that reads data from standard input, sorts it, and outputs it to standard output. You are going to write a program that invokes sort as a new process, writes data to its input, and reads data from its output. The user will type in an NSTextView, click a button to trigger the sort, and read the result in another NSTextView. It will look like Figure 19.1:

Figure 19.1  SortThem application running

SortThem application running

For the record, this is not how we would do a sort in a real application. The NSArray class has a couple of elegant ways to do sorting. This is just a simple example of using ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.