I have a file of words/phrases separated by newlines. I need to get the file and read each word/phrase into the array. I have this so far:
NSFileHandle *wordsFile = [NSFileHandle fileHandleForReadingAtPath:[[NSBundle mainBundle] pathForResource:@"WordList"
ofType:nil]];
NSData *words = [wordsFile readDataToEndOfFile];
[wordsFile closeFile];
[wordsFile release];
But I'm not sure if that's right, and if so, where to go from there.
Also, teabot's answer of
NSString componentsSeparatedByCharactersInSet: NSCharacterSet newlineCharacterSet
works great, but it's 10.5 only. How would this behavior be replicated for 10.4?