views:

219

answers:

1

Hey guys,

How do you read text files in objective c? I just need the coding.

Thanxs.

+7  A: 

To read in a plain text file into a string, just use stringWithContentsOfFile, like so:

NSString *info = [NSString stringWithContentsOfFile:@"/path/to/myfile.txt"];
John Feminella
Ok so the variable is "info". I want this to show in the contents of a NSTextField. How would I be able to do this?
Kevin