I have program, which uses threads to run 2 functions separately. I want output of func1 be in console window from which I launch program and output of func2 to be in newly created window. Any suggested solutions on that?
I use system("konsole"); to create new console in func2, but it just freezes output in first window (I mean program is running, but output is frozen till I close new console window).
This works for me (on Linux with
/proc
mounted by default; other operating systems, or Linux with /proc not mounted, won't work).Writes to
p
appear in the konsole window. We rely on the fact that the parent process of the shell is the terminal emulator itself, and steal its standard input.A more POSIX-y way would be to set up a named pipe and have the program write to it, while
cat
in a spawned terminal emulator is reading from it.