Thread: What is getopt?

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    182

    What is getopt?

    I've been looking at sources of other programs and I've seen some that use getopt... I believe it is used to parse command line arguments but I still don't understand what it is exactly, and I have no idea of how could I put it in my code.

    Could someone orient me with this one? What exactly is it and how could I use it in my own programs? I use MinGW with MSYS on Windows XP, just in case.

    Thanks!

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Use Google.

    man page: http://www.gnu.org/software/libtool/...bc/Getopt.html
    details and example: http://www.gnu.org/software/libtool/...bc/Getopt.html

    [edit] getopt() should exist in MinGW. (Google thinks so too.) It's a Linux/GNU/POSIX thing, but then MinGW is a port of GCC. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    182

    Talking

    geeze... everything is included with my compiler, I should've just checked the documentation. Sorry for bothering.
    Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getopt question
    By -EquinoX- in forum C Programming
    Replies: 5
    Last Post: 03-26-2009, 08:42 PM
  2. Case-insensitive getopt()
    By Ehtyar in forum C Programming
    Replies: 10
    Last Post: 11-20-2008, 03:21 AM
  3. getopt help
    By wuzzo87 in forum C Programming
    Replies: 12
    Last Post: 04-09-2007, 03:16 AM
  4. getopt and multiple options
    By bej in forum Linux Programming
    Replies: 2
    Last Post: 11-17-2005, 04:51 PM
  5. getopt() and weird output
    By kristy in forum C Programming
    Replies: 2
    Last Post: 06-28-2003, 04:39 PM