Thread: Command line

  1. #1
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198

    Command line

    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

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    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.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed
Website Security Test