+ 1
Does how to run programs has something to do with the default streams?
I've read in a book that "If you run a program from the command prompt or terminal, the OS will set the stdin to keyboard and stdout and stderr to the display by default." What does the book imply by saying: "If you run a program from the command prompt or terminal," does it mean if the program hasn't been run from the terminal, those streams won't be set by default?
1 Answer
+ 2
No, I think the streams will always be set correctly, based on the environment from where the code is run. i.e. if they're run from an IDE, stdout and stderr will probably default to the console in the IDE etc.