Saving the Output The shell makes this easy too ./prog < test.in > outfile Now the output from std::cout will be in outfile Saving std::cerr is possible too ./prog < test.in 2> errfile ./prog < test.in > outfile 2> errfile ./prog < test.in 1> outfile 2> errfile ./prog < test.in > outfile 2>&1 ./prog > outfile 2> errfile