Thread: Command-Line Switches

  1. #1
    liveapple2000
    Guest

    Command-Line Switches

    I learned C++ and I am very interested in learning how to create command-line switches for my applications so that I can have extra features in them. What would be the starting point for the application? I have Microsoft Visual C++ 6.0 Enterprise. Thank you.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    You can pass arguments on the command-line to your program

    Code:
    int main (int argc, char **argv)
    {
        int retval;
    
        return retval;
    }
    Variable argc is the number of parameters on the command-line. This value is at least 1, since the name of the program is the first parameter. The variable argv points to the list of arguments.

    >I have Microsoft Visual C++ 6.0 Enterprise.

    And that's running under DOS?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple command line arguments with switches
    By Ene Dene in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2009, 03:28 AM
  2. simple question regarding switches
    By ove256 in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-24-2005, 12:01 AM
  3. toggle switches and LEDs
    By cprogrammer2003 in forum C Programming
    Replies: 11
    Last Post: 07-22-2003, 12:35 PM
  4. switches and breaks
    By volk in forum C Programming
    Replies: 11
    Last Post: 01-10-2003, 08:55 PM
  5. Microswitch joysticks and arcade switches
    By Scourfish in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-30-2001, 07:50 PM