Redirecting stdin

When your program reads from std::cin, it reads from standard input, or file descriptor 0 (where 1 is standard output and 2 is standard error). If you want to read from a file instead, you can redirect from the file to file descriptor 0.