checking process existed

On HP-UX, in application, if the process id has been get with the getpid() and sotred in database, then other monitor process want to check it if the process is existed, are there any system function can do it? I do not want to use the shell script, because it should use popen function to excuted and get the return, popen manupulate the pipe from process, it sometimes cause much I/O.

try man utmp or man wtmp.

The files record system activity, the man pages document calls to read the files directly.
No popen needed.

Thanks, I'll try it.
Here is another question:
On HP-UX, how the file with the # character at the beginning generate and how to avod it?

Which file are you talking about? Can you give an example?

The filename preceded with pound sign (#), such as:
#hosts,#ntp.conf, #myprog, etc.

Once the opendir() or readdir() encounters the above format filename, the operation exit and can not look through the directory normmally. we want to void it.

You can use ftw() or nftw(). Those require you to define a callback function that decides whether or not to continue.

I also don't see why readdir would exit, do you check return codes from opendir() and readdir() when this occurs? If you are using system() to do something, the shell being run in the system call will treat the '#' as a comment, rather than a file name.