Dne středa 28 červen 2006 15:51 Petr Uzel napsal(a):
> Dne středa 28 červen 2006 15:04 Iain Buchanan napsal(a):
> > Hi again :)
> >
> > I have been googling for this one for a little while, and trying various
> > options, but I can't seem to find it:  How do I get the process from
> > within a process in c or c++?
> >
> > I don't want to use argv[0], because the particular place is deep within
> > classes, and there are too many (I'm doing some porting) to edit all of
> > their constructors, for example, to pass argv[0].
> >
> > something like
> >
> > char *name = getpsname (pid);
>
> Hi,
> what about directly reading /proc/pid_of_the_process/stat (may be some
> other file in this directory).

Now I found better solution :
file /proc/self/status is a link pointing to the 
directory /proc/pid_of_process. And by parsing status file in this directory 
you should get all the informations you want.

-- 
Petr Uzel
[EMAIL PROTECTED]
Jabber : [EMAIL PROTECTED]
ICQ : 101606095
Gentoo Linux

-- 
gentoo-user@gentoo.org mailing list

Reply via email to