generated from freudenreichan/info2Praktikum-Wortsalat
Compare commits
No commits in common. "a78c1e2ea28de1798ca0fb910f040d54a9c709df" and "4fea2c9f7b08a31823487efb3d6e4796df92ad92" have entirely different histories.
a78c1e2ea2
...
4fea2c9f7b
BIN
Start_Windows/game.o
Normal file
BIN
Start_Windows/game.o
Normal file
Binary file not shown.
BIN
Start_Windows/graphicalGame.o
Normal file
BIN
Start_Windows/graphicalGame.o
Normal file
Binary file not shown.
@ -8,6 +8,7 @@
|
||||
// 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;
|
||||
@ -18,18 +19,14 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
|
||||
while(word_parts != NULL && counter < maxWordCount)
|
||||
{
|
||||
// Kopiere das Wort in words-Array
|
||||
strncpy(words[counter], word_parts, MAX_WORD_LEN - 1);
|
||||
words[counter][MAX_WORD_LEN - 1] = '\0';
|
||||
|
||||
// Alles in Großbuchstaben umwandeln
|
||||
for(i = 0; words[counter][i] != '\0'; i++)
|
||||
{
|
||||
words[counter][i] = toupper(words[counter][i]);
|
||||
}
|
||||
counter++; // Wort eingelesen, Wortzähler erhöhen
|
||||
word_parts = strtok(NULL, ",;\n\t/. "); //NULL für Zeiger angeben
|
||||
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;
|
||||
}
|
||||
BIN
Start_Windows/input.o
Normal file
BIN
Start_Windows/input.o
Normal file
Binary file not shown.
BIN
Start_Windows/main.o
Normal file
BIN
Start_Windows/main.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user