Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getopt() in VC++

I'm quite fond of using GNU getopt, when programming under Linux. I understand, that getopt(), is not available under MS VC++.

Note:

  • Win32 environment
  • using Visual Studio
  • No Boost
  • No MFC
  • Not concerned with portability

Question:

  • How can I then port getopt() accordingly?
    • What guidelines should I be aware of while porting?
  • Known port with same features?
like image 810
Aaron Avatar asked Feb 12 '09 21:02

Aaron


3 Answers

This may help, it's also very easy to integrate

http://www.codeproject.com/KB/cpp/xgetopt.aspx

like image 80
Andrew Grant Avatar answered Oct 24 '22 17:10

Andrew Grant


There is some old code originally by IBM that is available as-is. It only has implementation for getopt, not the _long variants. It's available on http://plexfx.org/news/files/70411c2c371bd686273a8bebc42c45c5-3.html

like image 23
Bob Prystanek Avatar answered Oct 24 '22 19:10

Bob Prystanek


You will have to check out the license requirements, but the source to the GCC libraries is freely available. Just grab getopt() from there.

like image 28
Harold Bamford Avatar answered Oct 24 '22 18:10

Harold Bamford