generated from freudenreichan/info2Praktikum-Wortsalat
Compare commits
4 Commits
099243b5e2
...
4fea2c9f7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fea2c9f7b | ||
|
|
817f35a154 | ||
|
|
19787739a7 | ||
|
|
3657ee5ff7 |
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,5 +8,25 @@
|
|||||||
// 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 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;
|
||||||
}
|
}
|
||||||
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.
@ -47,4 +47,4 @@ clean:
|
|||||||
#hier eigene wordsalad kopieren, library rauslassen
|
#hier eigene wordsalad kopieren, library rauslassen
|
||||||
|
|
||||||
wordsalad_myversion: main.o input.o game.o graphicalGame.o $(BINARIES)/libwordsalad.a
|
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