Hello everybody,

For the past days, I've been googling like a maniac looking for information so I would be able to solve this problem, but I haven't been able to.

Everybody knows the Hangman game, you get a word, you guess, and if you miss too much, you get hanged.

I've got most of the "easy" part of the game done, but there is one thing that is bugging me a lot.

I thought of doing the game in 3 different ways, two of them which I don't know how to do them even tho I've researched and looked quite a bit about working with files but the information is not extensive enough.

1st way: Let the user put the word himself, maybe then a friend come thru and try to guess it. Way easier, but not the way I want it.

2nd way: Have a .txt file with 1 word per line, then get a random number (which I know how to get)
having this declared already:
Code:
FILE *fp;
	int fclose(FILE *fp);
then open the file (which I guess is this way)
Code:
	if ((fp = fopen("wordlist.txt", "r")) == NULL)
    {
       printf("The file could not be opened.\n");
       exit(1);        
    }
BUT what I don't know how to do is, to use that random number to read one of the lines of the file, and pass that onto a variable that I can use so the user can try to guess the word.

I truly hope you can help me.

Kindest Regards,
Piradie