Fileöffner verbessert

This commit is contained in:
Bastian 2025-10-23 11:24:50 +02:00
parent eb15c18771
commit 3c68ced8ab

View File

@ -9,11 +9,11 @@
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
//Erstellt Pointer auf textdokument
FILE *textdokument = fopen("words.txt", "r");
if (file == NULL) {
printf("words,txt konnte nicht geoffnet werden");
FILE *textdokument = fopen(file, "r");
if (textdokument == NULL) {
printf("Datei konnte nicht geoffnet werden");
}
// ToDo 2D char Array um wörter zu speichern kommt hier rein
// 2D char Array um wörter zu speichern
char word[MAX_WORD_LEN];
unsigned int count = 0;
while (fscanf(textdokument, "%s", word) != EOF && count < maxWordCount) {