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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.