views:

439

answers:

2

Is there an equivalent to getopt() in the visual studio CRT?

Or do I need to get it and compile it with my project?

Edit clarification
getopt is a utility function in the unix/linux C Run Time library for common command line parsing chores i.e. parsing arguments of the form -a -b -f someArg etc'

+5  A: 

Advice: boost::program_options instead.

http://www.boost.org/doc/libs/1%5F41%5F0/doc/html/program%5Foptions.html

Pavel Radzivilovsky
it's nasty, but it suffices, i've used this in place of getopt too
Matt Joiner
It has minor nastyness until you get used to it, but then you have a whole bunch of benefits. It's a by-policy standard of cmdl parsing in my company.
Pavel Radzivilovsky
+1  A: 

You can use the getopt implementation from the GNU C library. It's licensed under the LGPL, which should be compatible with most software projects. See the file posix/getopt.c in the source distribution.

Adam Rosenfield