tags:

views:

120

answers:

2

I used daemon() and fork() to move my program to the background.
How can I bring it back to the foreground?
Is there a c++ function that do so?
thank you.

edited:
I understand that there is no way back from daemon() so how can I move my program from foreground to background and back?

+2  A: 

what daemon does is to close the standard io channels. There is no way to 'reopen' them. A standard practice is to arrange for some other IPC mechanism, such as a socket, and interact with the daemonized process with another program.

TokenMacGuy
A: 

There is no C++ command for this. fork() and daemon() aren't C++ commands. They are POSIX commands (it helps to keep the difference in mind).

You can increase how often your program is scheduled time on the CPU with the command line utility renice, but that won't get you any windows or messages from the program.

Max Lybbert