You may use the
class, see the sample code in the documentation page [^
You may also leave the application as it stands and redirect the output on calling the executable.
For instance, suppose your application's name is
, then issuing
mycomp.exe > result.txt
will redirect the output of your program to the