Command-Line Switches

This is a discussion on Command-Line Switches within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I learned C++ and I am very interested in learning how to create command-line switches for my applications so that ...

  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,386
    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, 02: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, 07: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21