问题
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 clarificationgetopt
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'
回答1:
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.
回答2:
Advice: boost::program_options instead.
http://www.boost.org/doc/libs/1_41_0/doc/html/program_options.html
来源:https://stackoverflow.com/questions/1935455/getopt-for-visual-studio-crt