From: Steve Graegert <graegerts@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: argv[0]
Date: Fri, 13 Jan 2006 13:26:44 +0100 [thread overview]
Message-ID: <6a00c8d50601130426u2a9640evc14ee8c3d61c7925@mail.gmail.com> (raw)
In-Reply-To: <200601130016.23410.a.biardi@tiscali.it>
On 1/13/06, a.biardi@tiscali.it <a.biardi@tiscali.it> wrote:
>
> Hi,
>
> Is there any C function that can tell me what argv[0] is, outside
> main()?
>
> I thought to use getpid() and then look at /proc/<pid>/cmdline but
> doesn't seem portable. Any hints?
The arguments are pushed on the stack upon process creation. Once the
process is running there is little chance to get hands on them except
for the /proc approach.
\Steve
--
Steve Graegert <graegerts@gmail.com>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212
next prev parent reply other threads:[~2006-01-13 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 23:16 argv[0] a.biardi
2006-01-13 9:52 ` argv[0] wwp
2006-01-13 11:52 ` argv[0] a.biardi
2006-01-13 12:19 ` argv[0] Neil Horman
2006-01-13 12:26 ` Steve Graegert [this message]
2006-02-24 13:59 ` argv[0] a.biardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d50601130426u2a9640evc14ee8c3d61c7925@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).