Have you tried libproc (distributed with procps)? You won't get nearer to the actual data than scanning /proc (whose purpose is exactly this, exporting PROCess data to user space) and libproc does this for you. There may be other libs for this task. The format of /proc is system dependent, so don't access it yourself, if you expect your program to run under Solaris, BSD, MacOSX or similar.
The easiest and probably most portable way is to actually start "ps -a" as a child process and parse the output.
libproc
Have you tried libproc (distributed with procps)? You won't get nearer to the actual data than scanning /proc (whose purpose is exactly this, exporting PROCess data to user space) and libproc does this for you. There may be other libs for this task. The format of /proc is system dependent, so don't access it yourself, if you expect your program to run under Solaris, BSD, MacOSX or similar.
The easiest and probably most portable way is to actually start "ps -a" as a child process and parse the output.