save the output of child process
In Gnome desktop manager, you have virtual desktops or workspace. Click here if u don't know what virtual desktop is:
http://www.mozillaquest.com/Linux4Wi..._Story-01.html
Now, assume you have program called "stupid" that can guess what workspace u r in now. Assume you are in workspace number one and in console you type:
$ stupid
The stupid person are in workspace 0
You go to workspace number 2 and run it again:
$ stupid
The stupid person are in workspace 1
Now I want to make wallpaper changer according to this program. This is my idea. I make the daemon and check every half second with this function:
Code:
string bullStrong;
while(TRUE) {
execlp("stupid", NULL);
//I want to save the stdout of this child process to string
//but I don't know how
bullStrong = howDoISaveIt();
//some code here
ChangeTheWallpaper(bullStrong);
}
Would you help me write the howDoISaveIt() function please?