get the command line, removing the program name
#include <process.h> char *getcmd( char *cmd_line );
The getcmd() function causes the command line information, with the program name removed, to be copied to cmd_line. The information is terminated with a '\0' character. This provides a method of obtaining the original parameters to a program as a single string of text.
This information can also be obtained by examining the vector of program parameters passed to the main function in the program.
The address of the target cmd_line.
Suppose a program is invoked with the command line
myprog arg-1 ( my stuff ) here
where that program contains
#include <stdio.h> #include <process.h> void main() { char cmds[128]; printf( "%s\n", getcmd( cmds ) ); }
The output is:
arg-1 ( my stuff ) here
WATCOM
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
abort(), atexit(), _bgetcmd(), close(), _cmdname(), exec... functions, exit(), _exit(), getenv(), main(), onexit(), putenv(), sigaction(), signal(), spawn... functions, system(), wait(), waitpid()