get the executing program's pathname
#include <process.h> char *_cmdname( char *buffer );
The _cmdname() function obtains a copy of the executing program's pathname, and places it in buffer.
If the pathname of the executing program cannot be determined then NULL is returned; otherwise the value of buffer is returned.
#include <stdio.h>
#include <process.h>
void main()
{
char buffer[PATH_MAX];
printf( "%s\n", _cmdname( buffer ) );
}
WATCOM
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes, but modifies errno |
| Thread | Yes |