generated from freudenreichan/info2Praktikum-Wortsalat
Compare commits
No commits in common. "4fea2c9f7b08a31823487efb3d6e4796df92ad92" and "099243b5e2e12b6ff30875b5c31db15256750454" have entirely different histories.
4fea2c9f7b
...
099243b5e2
Binary file not shown.
Binary file not shown.
@ -8,25 +8,5 @@
|
||||
// Read words from file and store in 'words' array
|
||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
{
|
||||
|
||||
char puffer[MAX_LINE_LEN]; //Array für eingelesene Zeile
|
||||
int counter = 0; //Zähler für Anzahl eingelesener Wörter
|
||||
int i;
|
||||
|
||||
while(fgets(puffer, MAX_LINE_LEN-1, file) != NULL && counter < maxWordCount)
|
||||
{
|
||||
char *word_parts = strtok(puffer, ",;\n\t/. "); //Wörter aufteilen
|
||||
|
||||
while(word_parts != NULL && counter < maxWordCount)
|
||||
{
|
||||
for(i = 0; i < MAX_WORD_LEN -1 && word_parts[i] != '\0'; i++)
|
||||
{
|
||||
words[counter][i] = toupper(word_parts[i]); //Großbuchstaben erzeugen
|
||||
}
|
||||
words[counter][i] = '\0'; //Stringdefinition vervollständigen
|
||||
}
|
||||
counter++; // Wort eingelesen, Wortzähler erhöhen
|
||||
word_parts = strtok(NULL, ",;\n\t/. "); //NULL für Zeiger angeben
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@ -47,4 +47,4 @@ clean:
|
||||
#hier eigene wordsalad kopieren, library rauslassen
|
||||
|
||||
wordsalad_myversion: main.o input.o game.o graphicalGame.o $(BINARIES)/libwordsalad.a
|
||||
$(CC) $(CFLAGS) -o wordsalad_myversion main.o input.o game.o graphicalGame.o $(BINARIES)/libwordsalad.a $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -o wordsalad_myversion main.o input.o game.o graphicalGame.o $(BINARIES)/libwordsalad.a $(LDFLAGS)
|
||||
Loading…
x
Reference in New Issue
Block a user