neue makefile aus e mail kopiert

This commit is contained in:
Luis Gessnitzer 2025-10-28 14:52:29 +01:00
parent 18197c1a25
commit a413f8fe7f
3 changed files with 33 additions and 4 deletions

View File

@ -24,6 +24,15 @@ target_link_libraries(info2Praktikum_Wortsalat
${CMAKE_SOURCE_DIR}/Start_Windows/windows/libraylib_mingw.a ${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: # Optional: falls du auf Windows bist und -lopengl32 o.ä. brauchst:
if (WIN32) if (WIN32)
target_link_libraries(info2Praktikum_Wortsalat opengl32 gdi32 winmm) target_link_libraries(info2Praktikum_Wortsalat opengl32 gdi32 winmm)

View File

@ -6,7 +6,26 @@
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. // 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 // 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) 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");
} }
}
}
/*
char words[MAX_LINE_LEN][MAX_WORD_LEN];
unsigned int wordCount =0;*/

View File

@ -3,7 +3,7 @@
#include "input.h" #include "input.h"
#include "game.h" #include "game.h"
#include "graphicalGame.h" #include "graphicalGame.h"
// hallo Hallo Wario Schmolb
//halloooo //halloooo
#define MAX_NUMBER_OF_WORDS 100 #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 // Check if the correct number of arguments is provided
if(argc != 2) if(argc != 2)
{ {
fprintf(stderr, "Usage: %s <path to file with search words>\n", argv[0]); printf("Keine Datei angegeben versuche Standarddatei 'words.txt'...\n");
exitCode = EXIT_FAILURE; argv[1] = "words.txt";
argc = 2;
} }
else else
{ {