Re: reading input from stdin
Re: reading input from stdin
- Subject: Re: reading input from stdin
- From: Cameron Hayne <email@hidden>
- Date: Tue, 11 Nov 2003 23:06:48 -0500
On 10/11/03 11:55 PM, "pmcurry" <email@hidden> wrote:
>
NSData* inputData = [[NSFileHandle fileHandleWithStandardInput]
>
availableData];
>
NSString* inputString = [[NSString alloc] initWithData:inputData
>
encoding:NSASCIIStringEncoding];
You need to parse the string, breaking it up into the individual lines by
looking for the embedded '\n' characters. I believe there are some NSString
methods that will help with this.
That will make it work no matter how many lines you read at a time - i.e
whether it is gulped up from an input files or typing in line by line at the
console.
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
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.