DEV Community

Discussion on: C++ read file from stdin

Collapse
 
sfiquet profile image
Sylvie Fiquet

I'm not super familiar with modern C++ but I believe stdin's purpose is for getting input from the console/terminal. So I don't understand why you would read a file from stdin and in any case why you would redefine stdin. Maybe you're supposed to type something like this on the CLI:

myprogram < input.txt

so that file input.txt ends up in the stdin for the program? That's all I can think of.