Hi I need to parse a text file one line at a time...and is there EOF in objective c?
Thanks satish
Hi I need to parse a text file one line at a time...and is there EOF in objective c?
Thanks satish
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.
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.