uppercase fixed
This commit is contained in:
parent
30ef5e53f5
commit
ad88cbbba6
@ -13,7 +13,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
char *token;
|
||||
file = fopen("words.txt", "r");
|
||||
|
||||
if(file == NULL)
|
||||
if (file == NULL)
|
||||
{
|
||||
printf("\nNot able to open file.\n");
|
||||
fclose(file);
|
||||
@ -29,14 +29,21 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
while (token != NULL)
|
||||
{
|
||||
strncpy(words[n], token, MAX_WORD_LEN);
|
||||
|
||||
char *s = words[n];
|
||||
while (*s)
|
||||
{
|
||||
*s = toupper((unsigned char)*s);
|
||||
s++;
|
||||
}
|
||||
|
||||
// printf("Einzelwort: %s\n", words[n]);
|
||||
|
||||
token = strtok(NULL, teiler);
|
||||
n++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose(file);
|
||||
return 0;
|
||||
return n;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user