Does how to run programs has something to do with the default streams? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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?

1st Apr 2018, 10:27 PM
omar alhelo
omar alhelo - avatar
1 Antwort
+ 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.
1st Apr 2018, 11:35 PM
Emma