what about text that appeared due to other reasons..like say i did system("blah.bat");
which would run a bat file and since it's dos-based, it would run in the console program. i want to pipe the output of blah.bat as well
You don't have control over that output. Not to mention that system() is blocking, so the thread that called it can't do anything until system() returns.
The best you can do is >file inside system() and have another thread periodically check what changed in the file, if anything.