>Do you have any idea what API calls I should look for?
>
Yep, all the basic file I/O APIs; you need to open STDOUT for output and write everything to whatever file handle is assigned.
If you don't need to write to the console, then you can just read the command line as parameters from the main line program, and ignore writing to STDOUT; create a log file instead, and have your batch file display it if not empty.