diff --git a/CMakeLists.txt b/CMakeLists.txt index abfdcc6..91f49d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,15 @@ target_link_libraries(info2Praktikum_Wortsalat ${CMAKE_SOURCE_DIR}/Start_Windows/windows/libraylib_mingw.a ) + +# words.txt beim Bauen automatisch ins Ausgabeverzeichnis kopieren +configure_file( + ${CMAKE_SOURCE_DIR}/Start_Windows/words.txt + ${CMAKE_CURRENT_BINARY_DIR}/words.txt + COPYONLY +) + + # Optional: falls du auf Windows bist und -lopengl32 o.ä. brauchst: if (WIN32) target_link_libraries(info2Praktikum_Wortsalat opengl32 gdi32 winmm) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index ed77805..e0e3042 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -6,7 +6,26 @@ // 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 +// f gets ; komma und semikolon erkennen und alles in groß buchstaben (=uppercase) int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { + file = fopen("words.txt", "r"); + if (file == NULL) + { + printf("Fehler: Datei konnte nicht geöffnet werden!\n"); + return 1; + } + else (file != NULL) + { + printf("Datei konnte geöffnet werden"); -} \ No newline at end of file + } + } + +} + + + +/* + char words[MAX_LINE_LEN][MAX_WORD_LEN]; + unsigned int wordCount =0;*/ \ No newline at end of file diff --git a/Start_Windows/main.c b/Start_Windows/main.c index 36b0222..d1e4c4b 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -3,7 +3,7 @@ #include "input.h" #include "game.h" #include "graphicalGame.h" -// hallo Hallo Wario Schmolb + //halloooo #define MAX_NUMBER_OF_WORDS 100 @@ -16,8 +16,9 @@ int main(int argc, char *argv[]) // Check if the correct number of arguments is provided if(argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exitCode = EXIT_FAILURE; + printf("Keine Datei angegeben – versuche Standarddatei 'words.txt'...\n"); + argv[1] = "words.txt"; + argc = 2; } else {