getopt_long_only tutorial?

This is a discussion on getopt_long_only tutorial? within the C Programming forums, part of the General Programming Boards category; Hi, Does anyone have an example or tutorial, on how to use getopt_long_only? I've looked at the documentation, but it's ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    245

    getopt_long_only tutorial?

    Hi,
    Does anyone have an example or tutorial, on how to use getopt_long_only?

    I've looked at the documentation, but it's not so clear to me. Googling only seems to return man page type stuff.

    Thank you!

  2. #2
    Registered User Char*Pntr's Avatar
    Join Date
    Sep 2007
    Location
    Lathrop, CA
    Posts
    198
    Quote Originally Posted by dayalsoap View Post
    Hi,
    Does anyone have an example or tutorial, on how to use getopt_long_only?

    I've looked at the documentation, but it's not so clear to me. Googling only seems to return man page type stuff.

    Thank you!
    When all else fails, there's Wikipedia.

    getopt - Wikipedia, the free encyclopedia

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by Char*Pntr View Post
    When all else fails, there's Wikipedia.

    getopt - Wikipedia, the free encyclopedia
    Thank you. Yes, I saw that, but it doesn't explain things like

    Code:
        static struct option long_options[] = {
            {"add", 1, 0, 0},
            {"append", 0, 0, 0},
            {"delete", 1, 0, 0},
            {"verbose", 0, 0, 0},
            {"create", 1, 0, 'c'},
            {"file", 1, 0, 0},
            {NULL, 0, NULL, 0}
        };
    what the heck are the 1,0,0 etc for? What do those mean?
    Last edited by dayalsoap; 09-22-2010 at 07:00 PM.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    245
    I still haven't been able to find a more thorough example or tutorial.

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    How about using google to find man? getopt_long(3): Parse options - Linux man page

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by Bayint Naung View Post
    How about using google to find man? getopt_long(3): Parse options - Linux man page
    yes, but that still doesn't explain waht the 1,0,0 0,0,0 and all of that stuff means.

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    245
    Is it blatantly obvious and there's just something that I'm missing?

  8. #8
    cas
    cas is offline
    Registered User
    Join Date
    Sep 2007
    Posts
    993
    Quote Originally Posted by dayalsoap
    Is it blatantly obvious and there's just something that I'm missing?
    Yes. Look at the definition for struct option in that man page.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 02:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-19-2002, 12:32 AM

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