I wrote a C++ program the generates and displays a summary to cout.
The summary is long and it is inconvenient to scroll and find the top of the summary in the terminal.
Currently I pipe the output to less:
$ ./print_test_case_summary | less
Is there a way a C++ program can pipe output to less instead of cout? e.g.
cless << "Summary";
Or maybe using system() e.g.
system("less");
I don't want to generate a file unless it is automatically deleted when less is closed.
You could do it, but then what if someone wants to send the output of the program to a file? It's better by far to type the extra 5 characters to pipe it to less.