Results 1 to 5 of 5

Thread: Module to process application parameters

  1. #1
    Join Date
    Jan 2006
    Location
    Moscow, Russia
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Module to process application parameters

    Hello!

    Has anyone a module to procees application parameters?

    For example, my application run with this parameters:
    myapp -h127.0.0.1 -Uusername mydb

    I need to recognize parameters and values. I can write my own module, but I think sombody already done it.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Module to process application parameters

    1. man getopt (and look at getopt_long)

    2. GetOpt class

  3. The following user says thank you to wysota for this useful post:

    gfunk (7th February 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Module to process application parameters

    1 is all good and well if you're writing specifically for unix.

    2 is Ok if you're writing a GUI application or an application that requires an event loop.

    Neither is acceptable if you're writing a simple server application that wants to parse the command line on startup and doesn't want the huge footprint of Qt's event loop or GUI.

    Has somebody written something like this yet?
    Life without passion is death in disguise

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Module to process application parameters

    I assure you the getopt class from Froglogic doesn't require an event loop... Moreover you can substitute Qt calls with STL calls and you'll strip the Qt dependency.

    For Windows you can use this:
    http://www.codeproject.com/cpp/xgetopt.asp

  6. #5
    Join Date
    Aug 2006
    Location
    Zürich, Switzerland
    Posts
    23
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Module to process application parameters


Similar Threads

  1. Replies: 8
    Last Post: 28th January 2015, 09:45
  2. Using Qt in an application with lots of parameters
    By Bookmarc in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2008, 21:52
  3. Show dialog application lunched as a process.
    By mourad in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2008, 13:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.