forked from freudenreichan/info2Praktikum-Wortsalat
22 lines
497 B
C
22 lines
497 B
C
#include "input.h"
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
|
|
// TODO:
|
|
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
|
|
|
// Read words from file and store in 'words' array
|
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|
{
|
|
if (file == 0) {
|
|
return -1;
|
|
}
|
|
int count = 0;
|
|
|
|
while(count < maxWordCount && scanf(file, %99s, words[count]) == 1){
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
} |