I have a file of words / phrases separated by newlines. I need to get a file and read every word / phrase in an array. I still have this:
NSFileHandle *wordsFile = [NSFileHandle fileHandleForReadingAtPath:[[NSBundle mainBundle] pathForResource:@"WordList" ofType:nil]]; NSData *words = [wordsFile readDataToEndOfFile]; [wordsFile closeFile]; [wordsFile release];
But I'm not sure if this is right, and if so, where to go from there.
Also answer teabot
NSStringSeparatedByCharactersInSet Elements: NSCharacterSet newlineCharacterSet
works great, but only 10.5. How will this behavior be replicated for 10.4?
arrays file objective-c cocoa
Walker
source share