I am kind of creating a watchdog which keeps the status log of other processes whose pids are known. I wana know if there is some c++ or c code to get this functionality.
views:
69answers:
2
                
                A: 
                
                
              
            I don't know if there is a direct way to do it, but you could always do a popen("/bin/ps", "r") and read in the results with fgets() and parse the text output.
                  Jeremy Friesner
                   2010-06-08 18:32:02
                
              
                +3 
                A: 
                
                
              
            You can read /proc/{PID}/status and parse the line beginning with "State:".
                  pau.estalella
                   2010-06-08 18:37:28