move c++ program to foreground
I us开发者_StackOverflowed daemon()
and fork()
to move my program to the background.
edited:
I understand that there is no way back fromdaemon()
so how can I move my program from foreground to background and back?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.
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.
精彩评论