Results 1 to 2 of 2
Hi all.
How can i obtain the pid of a process, by using a function?
Like, i know if i write x = system("pidof teste"), x is not the pid ...
- 03-08-2010 #1Just Joined!
- Join Date
- Oct 2009
- Posts
- 11
Know the output of a command in console
Hi all.
How can i obtain the pid of a process, by using a function?
Like, i know if i write x = system("pidof teste"), x is not the pid of the program teste but it is equal to 0.
How can i know the output of a command like that, but make it in a a program in C?
Thanks
- 03-08-2010 #2
In C, the system() command only returns the status (success or error code). You could look at the popen command or simply redirect the stdout for your command to a file and then read that file in your program.
HTHIf we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.


Reply With Quote