getopt under windows

Discussion in 'C Programming' started by Friedrich Dominicus, Nov 7, 2007.

  1. Markus Mayer <> writes:

    > Hi.
    >
    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)

    The glib contains something similiar visit pages below
    http://www.gtk.org/

    and libapr has something in that area also:
    http://apr.apache.org/docs/apr/1.2/group__apr__getopt.html

    Regards
    Friedrich

    --
    Please remove just-for-news- to reply via e-mail.
    Friedrich Dominicus, Nov 7, 2007
    #1
    1. Advertising

  2. Friedrich Dominicus

    Markus Mayer Guest

    Hi.

    Any chances that there is a similar thing to *nix's getopt() under
    windows? (It doesn't actually have to be too nifty, the requirement is
    just that it is stable.)

    Regards,
    Markus
    Markus Mayer, Nov 7, 2007
    #2
    1. Advertising

  3. In article <-berlin.de>,
    Markus Mayer <> wrote:
    >Hi.
    >
    >Any chances that there is a similar thing to *nix's getopt() under
    >windows? (It doesn't actually have to be too nifty, the requirement is
    >just that it is stable.)


    The obvious thing is: Google is your friend.

    /OT - I used getopts() in Windows all the time - under Cygwin - /OT

    (I don't know if there is a "native" API for it - Google [or MSDN] will
    tell you)
    Kenny McCormack, Nov 7, 2007
    #3
  4. Friedrich Dominicus

    jacob navia Guest

    Markus Mayer wrote:
    > Hi.
    >
    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)
    >
    > Regards,
    > Markus


    The lcc-win32 compiler has getopt() as part of its standard
    library. If interested I can mail you the source.

    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Nov 7, 2007
    #4
  5. Friedrich Dominicus

    Markus Mayer Guest

    Am 07.11.2007 14:12 postulierte Kenny McCormack folgendes:
    > In article <-berlin.de>,
    > Markus Mayer <> wrote:
    >> Hi.
    >>
    >> Any chances that there is a similar thing to *nix's getopt() under
    >> windows? (It doesn't actually have to be too nifty, the requirement is
    >> just that it is stable.)

    >
    > The obvious thing is: Google is your friend.


    No it's not. Google hates me.

    Regards,
    Markus
    Markus Mayer, Nov 7, 2007
    #5
  6. Friedrich Dominicus

    Markus Mayer Guest

    Am 07.11.2007 14:19 postulierte jacob navia folgendes:
    > Markus Mayer wrote:
    >> Hi.
    >>
    >> Any chances that there is a similar thing to *nix's getopt() under
    >> windows? (It doesn't actually have to be too nifty, the requirement is
    >> just that it is stable.)
    >>
    >> Regards,
    >> Markus

    >
    > The lcc-win32 compiler has getopt() as part of its standard
    > library. If interested I can mail you the source.
    >


    That would be nice. For my mail address, strip everything before the "@"
    sign from the address and replace it with "sunside".

    Thanks in advance!
    Markus
    Markus Mayer, Nov 7, 2007
    #6
  7. Friedrich Dominicus

    Markus Mayer Guest

    Am 07.11.2007 13:21 postulierte Friedrich Dominicus folgendes:
    > Markus Mayer <> writes:
    >
    >> Hi.
    >>
    >> Any chances that there is a similar thing to *nix's getopt() under
    >> windows? (It doesn't actually have to be too nifty, the requirement is
    >> just that it is stable.)

    > The glib contains something similiar visit pages below
    > http://www.gtk.org/
    >
    > and libapr has something in that area also:
    > http://apr.apache.org/docs/apr/1.2/group__apr__getopt.html


    Thanks, I'll have a look!

    Markus
    Markus Mayer, Nov 7, 2007
    #7
  8. Friedrich Dominicus

    Markus Mayer Guest

    problem solved (was: Re: getopt under windows)

    Am 07.11.2007 14:47 postulierte Markus Mayer folgendes:
    > Am 07.11.2007 14:19 postulierte jacob navia folgendes:
    >> Markus Mayer wrote:
    >>> Hi.
    >>>
    >>> Any chances that there is a similar thing to *nix's getopt() under
    >>> windows? (It doesn't actually have to be too nifty, the requirement is
    >>> just that it is stable.)
    >>>
    >>> Regards,
    >>> Markus

    >> The lcc-win32 compiler has getopt() as part of its standard
    >> library. If interested I can mail you the source.
    >>


    NetBSD/OpenBSD getopt(); getopt.h signature:
    /* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */
    /* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */

    I had to fine tune some things to make it work with VC++, but it now
    works like a charm.

    Thanks alot!
    Markus
    Markus Mayer, Nov 7, 2007
    #8
  9. Nemanja Trifunovic, Nov 7, 2007
    #9
  10. Friedrich Dominicus

    Ben Pfaff Guest

    Markus Mayer <> writes:

    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)


    getopt is pretty simple. Why not just implement it yourself?
    --
    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Ben Pfaff, Nov 7, 2007
    #10
  11. Friedrich Dominicus

    Markus Mayer Guest

    Am 07.11.2007 16:15 postulierte Nemanja Trifunovic folgendes:
    > On Nov 7, 8:01 am, Markus Mayer <>
    > wrote:
    >> Hi.
    >>
    >> Any chances that there is a similar thing to *nix's getopt() under
    >> windows? (It doesn't actually have to be too nifty, the requirement is
    >> just that it is stable.)
    >>

    >
    > Take a look at XGetopt: http://www.codeproject.com/cpp/xgetopt.asp
    >
    > Or even better, if you are using C++, there is Boost.Program_options
    > library which is portable: http://www.boost.org/doc/html/program_options.html
    >


    Damn, I always forget about Boost. I'll have a look at that, too.
    Thanks!

    Markus
    Markus Mayer, Nov 7, 2007
    #11
  12. Friedrich Dominicus

    user923005 Guest

    On Nov 7, 5:01 am, Markus Mayer <>
    wrote:
    > Hi.
    >
    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)


    There are getopt() variants available as source code all over the net.

    My favorite is my_getopt:
    http://www.geocities.com/bsittler/

    Next time, when you are looking for source code, do a web search.

    Asking news:comp.lang.c to do it for you is annoyingly lazy.
    user923005, Nov 7, 2007
    #12
  13. "Markus Mayer" <> wrote in message
    > Hi.
    >
    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)
    >

    Ypu seem to have found what you are looking for.
    There's an options parser on my website that does error-checking for you.
    However it works in rather a different way to getopt(). I'd like to think
    better.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
    Malcolm McLean, Nov 7, 2007
    #13
  14. On Nov 7, 8:01 am, Markus Mayer <>
    wrote:
    > Hi.
    >
    > Any chances that there is a similar thing to *nix's getopt() under
    > windows? (It doesn't actually have to be too nifty, the requirement is
    > just that it is stable.)
    >



    See XGetOpt: http://www.codeproject.com/cpp/xgetopt.asp
    Nemanja Trifunovic, Nov 8, 2007
    #14
  15. Friedrich Dominicus

    Markus Mayer Guest

    Am 08.11.2007 20:44 postulierte Nemanja Trifunovic folgendes:
    > On Nov 7, 8:01 am, Markus Mayer <>
    > wrote:
    >> Hi.
    >>
    >> Any chances that there is a similar thing to *nix's getopt() under
    >> windows? (It doesn't actually have to be too nifty, the requirement is
    >> just that it is stable.)
    >>

    >
    >
    > See XGetOpt: http://www.codeproject.com/cpp/xgetopt.asp
    >


    Yeah, I found that before but I forgot to mention that the solution I
    search(ed) for has to be ANSI C compatible.

    Thanks anyway!
    Markus
    Markus Mayer, Nov 9, 2007
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arvind Kumar

    Problem with Getopt

    Arvind Kumar, Nov 3, 2003, in forum: Perl
    Replies:
    1
    Views:
    557
    Jim Gibson
    Nov 3, 2003
  2. hshdude
    Replies:
    12
    Views:
    1,035
    Dimitri Maziuk
    Nov 4, 2004
  3. Angel Tsankov

    getopt and getopt_long for Windows?

    Angel Tsankov, Mar 3, 2006, in forum: C++
    Replies:
    1
    Views:
    2,074
    mlimber
    Mar 3, 2006
  4. mothra
    Replies:
    3
    Views:
    317
    Shawn Corey
    Dec 2, 2004
  5. Stefan Ram
    Replies:
    5
    Views:
    129
    Stefan Ram
    Mar 17, 2014
Loading...

Share This Page