Format Project

This commit is contained in:
Tobias Linz committed 2026-10-29 16:00:21 +01:00
1 parent 4a7d34044b
commit e94da31756
4 files changed
+33 -39

No files matched your search

+5 -6
View File
@@ -1,14 +1,17 @@
#include "input.h"
#include <string.h>
int readWord(char *buffer, char *divisor, char words[][MAX_WORD_LEN], unsigned int maxWordCount, int *count);
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) {
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
char buffer[MAX_LINE_LEN];
int count = 0;
char *divisor = " ,;.\n";
while (fgets(buffer, MAX_LINE_LEN, file) != NULL) {
while (fgets(buffer, MAX_LINE_LEN, file) != NULL)
{
for (char *word = strtok(buffer, divisor); word != NULL && count < maxWordCount; word = strtok(NULL, divisor))
{
strncpy(words[count], word, MAX_WORD_LEN);
@@ -17,7 +20,3 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
}
return count;
}