// io.c // Řešení IJC-DU2, příklad b), 22.4.2024 // Autor: Roman Nečas, FIT // Přeloženo: gcc 11.4.0 #include #include #include "io.h" int read_word(char *s, int max, FILE *f) { int c, len = 0; while ((c = fgetc(f)) != EOF && isspace(c)) ; // ignoruj uvodne biele znaky if (c == EOF) return EOF; s[len++] = c; while ((c = fgetc(f)) != EOF && !isspace(c)) { if (len < max) s[len++] = c; } s[len] = '\0'; return len; }