On Friday 13 January 2006 13:26, you wrote: > On 1/13/06, a.biardi@xxxxxxxxxx <a.biardi@xxxxxxxxxx> 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 > Just in case anybody needs it, I think I found something inside errno.h (GNU-only): /* The full and simple forms of the name with which the program was invoked. These variables are set up automatically at startup based on the value of ARGV[0] (this works only if you use GNU ld). */ extern char *program_invocation_name, *program_invocation_short_name;¶ Bye, Andrea. - : send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html