input filled with logic

This commit is contained in:
maxgrf 2025-11-03 22:24:46 +01:00
parent 099243b5e2
commit 3657ee5ff7
6 changed files with 26 additions and 1 deletions

BIN
Start_Windows/game.o Normal file

Binary file not shown.

Binary file not shown.

View File

@ -8,5 +8,30 @@
// 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)
{ {
// MAX_WORD_LEN 100
// MAX_LINE_LEN 1024
// *file ist Datei
// words ist Array
// MAX_WORD_LEN ist maximale Wortlänge
// maxWordCount ist maximale Anzahl an Wörtern
char puffer[MAX_LINE_LEN];
int counter = 0;
while(fgets(puffer, MAX_LINE_LEN-1, file) != NULL && counter < maxWordCount)
{
char *parts = strtok(puffer, ",;/n/t. ");
while(parts != NULL && counter < maxWordCount)
{
//strncpy(words[counter][MAX_WORD_LEN], puffer, MAX_LINE_LEN-1);
//words[counter][MAX_WORD_LEN-1] = "\0";
//Großbuchstaben
for(int i = 0; i < MAX_WORD_LEN -1 && parts[i] != '\0'; i++)
words[counter][i] = toupper(parts[i]);
}
counter++;
parts = strtok(NULL, ",;/n/t. ");
}
return counter;
} }

BIN
Start_Windows/input.o Normal file

Binary file not shown.

BIN
Start_Windows/main.o Normal file

Binary file not shown.

View File

@ -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)