Printing a random question from a file

This is a discussion on Printing a random question from a file within the C Programming forums, part of the General Programming Boards category; I'm writing a program that outputs a random question from a file. In the file, I have each question numbered ...

I would have the user enter the number, then take in lines from input until you've reached the specified line number. No need to keep actual numbers in the lines in the file.

edit: my bad, generate a random number, then ....

edit2: well it seems you're making a trivia game? So then if you're planning on outputting many questions, I would first read in all the questions into an array of char arrays ( list of lines ) then you could use the actual random number as the index to the array of char arrays.