From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Fvkp8-0005S9-22 for garchives@archives.gentoo.org; Thu, 29 Jun 2006 00:56:02 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.7/8.13.6) with SMTP id k5T0sK67013982; Thu, 29 Jun 2006 00:54:20 GMT Received: from mail.netspace.net.au (cumulus.netspace.net.au [203.10.110.72]) by robin.gentoo.org (8.13.7/8.13.6) with ESMTP id k5T0mToh026491 for ; Thu, 29 Jun 2006 00:48:30 GMT Received: from orpheus (unknown [150.101.6.82]) by mail.netspace.net.au (Postfix) with ESMTP id 2F0B07D979 for ; Thu, 29 Jun 2006 10:48:24 +1000 (EST) Subject: Re: [gentoo-user] OT: get process name in c++ From: Iain Buchanan To: gentoo-user@lists.gentoo.org In-Reply-To: <200606281601.07029.petr.uzel@centrum.cz> References: <1151499883.17966.13.camel@orpheus> <200606281551.42342.petr.uzel@centrum.cz> <200606281601.07029.petr.uzel@centrum.cz> Content-Type: text/plain; charset=utf-8 Date: Thu, 29 Jun 2006 10:17:47 +0930 Message-Id: <1151542067.19231.0.camel@orpheus> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id k5T0sK6N013982 X-Archives-Salt: f499ea60-3ae0-4f79-9f7f-a5440be58d5f X-Archives-Hash: 907a4138306a2d1da6c61584027f215a On Wed, 2006-06-28 at 16:01 +0200, Petr Uzel wrote: > Dne st=C5=99eda 28 =C4=8Derven 2006 15:51 Petr Uzel napsal(a): > > Dne st=C5=99eda 28 =C4=8Derven 2006 15:04 Iain Buchanan napsal(a): > > > Hi again :) > > > > > > I have been googling for this one for a little while, and trying va= rious > > > options, but I can't seem to find it: How do I get the process fro= m > > > within a process in c or c++? > > > > > > I don't want to use argv[0], because the particular place is deep w= ithin > > > classes, and there are too many (I'm doing some porting) to edit al= l of > > > their constructors, for example, to pass argv[0]. > file /proc/self/status is a link pointing to the=20 > directory /proc/pid_of_process. And by parsing status file in this dire= ctory=20 > you should get all the informations you want. great idea, thanks! --=20 Iain Buchanan In every non-trivial program there is at least one bug. --=20 gentoo-user@gentoo.org mailing list