Fileöffner verbessert
This commit is contained in:
parent
eb15c18771
commit
3c68ced8ab
@ -9,11 +9,11 @@
|
|||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
//Erstellt Pointer auf textdokument
|
//Erstellt Pointer auf textdokument
|
||||||
FILE *textdokument = fopen("words.txt", "r");
|
FILE *textdokument = fopen(file, "r");
|
||||||
if (file == NULL) {
|
if (textdokument == NULL) {
|
||||||
printf("words,txt konnte nicht geoffnet werden");
|
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];
|
char word[MAX_WORD_LEN];
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
while (fscanf(textdokument, "%s", word) != EOF && count < maxWordCount) {
|
while (fscanf(textdokument, "%s", word) != EOF && count < maxWordCount) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user