Command line [Archive] - C Board

PDA

View Full Version : Command line


MethodMan
03-26-2002, 07:59 PM
Hello

How would I be able to read in a word off the command line and store it as a variable? Thanks

ex(prog name is test)
test word
-> I would like to store word into a variable



Thanks

SilentStrike
03-26-2002, 08:43 PM
int main(int argc, char* argv[]);

argc is the number of arguements. The first argument is the name of the program (in argv[0]), the second argument is whatever the second space delimited sequence was (and it's in argv[1]), the third is in argv[3], etc.