I need help reading in a .txt
file into a NSMutableArray
in Xcode. I want to read in a large file containing many different strings and integers in a specific order, then I want to create a new person object with the information read in and add each object to an array of person objects.
So if this was my text file:
Richard
Smith
richardsmitha@gmail.com
18
www.richardsmith.com
Steve
Jobs
stevejobs@apple.com
12
www.stevejobs.com
I want a method to assign the following:
firstName = Richard
lastName = Smith
email = richardsmith@gmail.com
age = 18
website = www.richardsmith@gmail.com
Then is should create the object with those values.
PersonObject *person = [[PersonObject alloc] init];
temp = [PersonObject createPerson:firstName:lastName:email:age:website];
NSMutableArray *people = [[NSMutableArray alloc] initWithObjects:PersonObject];
[people addObject:temp];
Then it should repeat for however many people there are in the .txt
file.