tags:

views:

552

answers:

3

Hi I need to parse a text file one line at a time...and is there EOF in objective c?

Thanks satish

A: 

Objective-C is a proper extension of C. Any C program is a valid Objective-C program. Among other things, this means that EOF defined in the standard C header "stdio.h" is an EOF marker in Objective-C as well.

Stephen Canon
+2  A: 

See ParseKit http://parsekit.com/

Robert French
+1  A: 

Something like this might work for you:

NSString *fileContents = [NSString stringWithContentsOfFile:@"myfile.txt"];
NSArray *lines = [fileContents componentsSeparatedByString:@"\n"];

This will give you an array where each element is a line of the string.

rein