summaryrefslogtreecommitdiff
path: root/session.c
blob: b04958d2cca378c1ceb365f3e6ecb6117ae45a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "session.h"

void startSession(FILE *dictionary)
{
	if ( dictionary != NULL )
	{
		int totalWords = lineCounter(dictionary);
		char *word;
		char reload = '\0';

		while( reload != 'q' )
		{
			word = getLine(dictionary, getRandomNumber(1, totalWords));
			printf("%s", word);
			free(word);
			reload = getchar();
		}
	}
}