• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Command line parameters

## Recommended Posts

GOD-CannoN    122
I posted this in general programming but got no response. So, one question? What are command line parameters?

##### Share on other sites
xstreme2000    152
A command line parameter is an setting you pass to a program from the command line. For example back it the days of DOS if you typed:

C:\>dir

in a directory with thousands of files you couldn''t read the ones at the top because you could only fit about 25 lines on the screen, you could avoid this by giving the /p command line parameter to the program "dir" and it would display a single screen at a time e.g.

C:\>dir /p

##### Share on other sites
DoomX    146
Command line parameters are parameters that are passed to an executable. For example, "ps -f" tells ps to give the full listing. Or, using halflife... "halflife.exe -console", tells the executable to enable the console in the game.
Implementing command line parameters is easy in c/c++ code.

  int main( int argc, char* argv[] ){#include ...do stuff with the command line parameters...return 1;}

argc is the number of parameters received, and argv contains a c-string representation of each of the parameters.

Edited by - DoomX on July 31, 2001 12:30:44 PM