generated from freudenreichan/info2Praktikum-Wortsalat
added functionality to input.c
This commit is contained in:
parent
8d8cb57e79
commit
a1f73a0e33
@ -8,5 +8,17 @@
|
|||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
|
char word[MAX_WORD_LEN];
|
||||||
|
|
||||||
|
// we possibly don't need fopen, since file is already a parameter
|
||||||
|
// fopen(stream)
|
||||||
|
|
||||||
|
fgets(word, MAX_WORD_LEN,file);
|
||||||
|
// fgets(string, length, file *stream)
|
||||||
|
|
||||||
|
strcpy(words[maxWordCount-1], word);
|
||||||
|
maxWordCount++;
|
||||||
|
// we possibly also won't need to close the
|
||||||
|
// fclose( *<stream>)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user