diff --git a/c-programming/io/freadln.c b/c-programming/io/freadln.c index f033f8e..c3daf43 100644 --- a/c-programming/io/freadln.c +++ b/c-programming/io/freadln.c @@ -122,6 +122,8 @@ typedef uintmax_t SIZE_T_FORMAT; typedef size_t SIZE_T_FORMAT; # endif +# define YN(boolean) ((boolean) ? "yes" : "no") + int main(void) { // stdin test printf("Type something> "); @@ -162,8 +164,8 @@ int main(void) { perror("freadln"); exit(EXIT_FAILURE); } else if (result == freadln_EOF || feof(f)) { - printf("File: EOF, breaking the loop (returned by function? %d, " - "feof? %d)\n", result == freadln_EOF, !!feof(f)); + printf("File: EOF, breaking the loop (returned by function? %s, " + "feof? %s)\n", YN(result == freadln_EOF), YN(feof(f))); break; } printf("File, line #%d: '%s' (%" PRIuSIZE " characters)\n", i + 1, line,