RE: [C help] how to...
Ah right. In that case, what I would do is read each line of text from the file into an array, then use the random number generated to index the array.
Reading the file in: I would use a while loop, checking for an EOF. Of course, to make the array in the first place, the number of lines in the file would need to be known.
It may be worth seeing if C++ has a class similar to Java's ArrayList, which implements an expandable array of objects.
|