I haven't read through everything there, but the whole thing about EOF is wrong, to say the least:
KernighanRitchieAndSTm32/EndofFile.md at master * akd-jls/KernighanRitchieAndSTm32 * GitHub
EOF means end of file. Ctrl-D is just a way to tell a process in a *nix system reading from a terminal that the end of file has been reached. All that typing Ctrl-D in a terminal does is causes the process to read zero bytes (the read() syscall returns 0), which is translated to "EOF" inside the C stdio. Redefining EOF to 0x04 is the wrong way to go about that, especially if you expect your library to work properly with actual files (say, on an SD card). The proper way to handle end-of-file in a terminal is to "cook" the user input in a similar way to *nix; the simplest approach is to make getchar() return EOF when it reads Ctrl-D from a terminal.