getcmd

get the command line, removing the program name

Synopsis:

#include <process.h>
char *getcmd( char *cmd_line );

Description:

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.

Returns:

the address of the target cmd_line

See also:

abort(), atexit(), _bgetcmd(), close(), exec... functions, exit(), _exit(), getenv(), main(), onexit(), putenv(), sigaction(), signal(), spawn... functions, system(), wait(), waitpid()

Examples:

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

Classification:

WATCOM

Systems:

All (except DOS/PM)