Incidentally, please don't use or encourage use of assert for checking for I/O errors or
other can-happen runtime conditions. Such checks will disappear when compiled with -DNDEBUG
(or conversely make it impractical to compile with -DNDEBUG, thus discouraging use of
assertions), and fail to give a meaningful error message. That should be if (!in_file) {
perror("foo.txt"); exit(EXIT_FAILURE); }.