Compare commits

...
3 Commits
Author SHA1 Message Date
dehmfl103364 da674a4ef6 Merge branch 'InputImplementierung' 2026-10-16 20:35:42 +02:00
dehmfl103364 5b6eae4c18 Merge remote-tracking branch 'origin/main' into InputImplementierung
Muss machen wegen Branchmerge
2026-10-16 20:16:09 +02:00
dehmfl103364 fe390a6f5f Input fertig mit Makefile für Input 2026-10-16 20:11:55 +02:00
2 changed files with 42 additions and 3 deletions

No files matched your search

+33 -3
View File
@@ -6,7 +6,37 @@
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
// 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 lineRead[MAX_LINE_LEN] = {};
char *splitters = ",; \n";
int wordsRead = 0;
while(fgets(lineRead,MAX_LINE_LEN,file) != NULL && wordsRead < maxWordCount){
char *token = strtok(lineRead, splitters);
while(token != NULL && wordsRead < maxWordCount){
strcpy(words[wordsRead],token);
//Kleinbuchstaben -> Grossbuchstaben
int len = strlen(words[wordsRead]);
for(int i = 0; i < len; i++){ //müsste einen kleinbustaben am ende haben
if(islower(words[wordsRead][i])){
words[wordsRead][i] = toupper(words[wordsRead][i]);
}
}
wordsRead++;
token = strtok(NULL, splitters);
}
}
return wordsRead;
}
}
+9
View File
@@ -22,6 +22,15 @@ codefolder = .
wordsalad_initial:
$(CC) -o wordsalad_initial -L. $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
#--------------
# Mein Test
#--------------
my_wordsalad_input: input.o $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a
$(CC) $(CFLAGS) -o my_wordsalad_input input.o $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
# --------------------------
# NUR Game Test
# --------------------------