We're reading a file from stdin into file_buffer
, and then stepping into a method more
.
As soon as we use system("stty cbreak -echo");
, the output prints "stty: stdin isn't a terminal" and doesn't set our terminal to the settings we asked for.
This problem only exists when we use standard in. If we use a file argument, the program works fine -- the terminal settings get set, and there is no error message.
So, this is okay: myprogram file1.txt
But this is not: myprogram < file1.txt
Either way the contents are being read into file_buffer
before being used at all. What the heck is wrong with using stty if we're taking input from stdin??