Extraction from the dark days of DOS programming here: try opening "CON:" (Console), a reserved word. Hope it opens in the same way on Windows. A colon may or may not be required. Both "dir> con:" and "dir> con" still work on the command line.
Also, do not forget to use something from the setbuf () family in the output descriptor to avoid buffering ... it should not buffer the I / O terminal, but it never hurts to be sure.
Again, Iām not sure, but I suspect opening a separate FILE *conin, *conout for output, and one for input may help if you have problems with a single descriptor that performs both input and output.
source share