Hello,
I am making an iPhone app to randomly pick a 6-digit ticket number from about 500 numbers. The app will be run in the simulator. It is for a technology-related contest, and the fact that I am using an iPhone app is entirely for show. I wanted to use an NSArray, but I think loading the data from a file will be much easier than that, since the tickets are going to be scanned, so I will already have all the numbers in a .txt file. How can I load 500 numbers from a txt file, with each of the 500 numbers on a line, totaling 500 lines? Is there some way to do something like:
If that worked, it would be perfect
I am making an iPhone app to randomly pick a 6-digit ticket number from about 500 numbers. The app will be run in the simulator. It is for a technology-related contest, and the fact that I am using an iPhone app is entirely for show. I wanted to use an NSArray, but I think loading the data from a file will be much easier than that, since the tickets are going to be scanned, so I will already have all the numbers in a .txt file. How can I load 500 numbers from a txt file, with each of the 500 numbers on a line, totaling 500 lines? Is there some way to do something like:
Code:
NSArray *tickets = [NSArray arrayWithObjects:[pathToResource:"tickets" of type:"txt"]];