fertiges Spiel
This commit is contained in:
parent
9fa6e5b499
commit
1332dc9355
Binary file not shown.
@ -14,15 +14,6 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
char *token;
|
||||
unsigned int wordCount = 0;
|
||||
|
||||
/* wird words.txt schon in main geöffnet?
|
||||
file = fopen ("words.txt", "r"); // Öffne words.txt zum lesen
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
while (fgets (puffer, 256, file) != NULL) //liest words.txt ein und speichert es in puffer
|
||||
{
|
||||
token = strtok(puffer, teiler); //token teilt erstes Wort und speichert es in sich ab
|
||||
@ -31,6 +22,10 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
{
|
||||
strncpy(words[wordCount], token, MAX_WORD_LEN -1); //kopiert das Wort von token in das array words
|
||||
words[wordCount][MAX_WORD_LEN-1] = '\0';
|
||||
// Konvertiere jedes Zeichen zu Großbuchstaben
|
||||
for (int i = 0; words[wordCount][i] != '\0'; i++)
|
||||
words[wordCount][i] = toupper(words[wordCount][i]);
|
||||
|
||||
wordCount++;
|
||||
token = strtok (NULL, teiler); //nächstes Wort
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "unity.h"
|
||||
#include "unity/unity.h"
|
||||
|
||||
#include "input.h"
|
||||
#include "game.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user