View Full Version : xcode C++ - getopt_long
alexWoz
Sep 12, 2009, 09:27 AM
For a C++ project in class I am required to parse command line options with two dashes in front of them (i.e. "--Stack" "--Time" etc). It was recommended we use getopt_long to help parse these options. However, while I know how to give my program arguments with a single dash, I cannot figure out how to do "long options" with the double dash. Does xcode support these types of arguments? Any help would be appreciated.
chown33
Sep 12, 2009, 12:52 PM
Read The Fine Man Page.
In Xcode, under the Help Menu, there is an item to read a man page. Choose that, then enter getopt_long. The man page for the function should appear.
By the way, it's not Xcode that supports these types of arguments, it's the getopt_long() function in the standard C library. You can use this function even if you're not using Xcode, e.g. if you were using gcc at the command-line, or a makefile.
alexWoz
Sep 12, 2009, 08:16 PM
Thanks for your reponse! I had no idea those man pages existed--definitely helpful. However, I'm still kind of confused... if I'm compiling my app within xcode, how can I pass those types of arguments? It works fine on a linux command line through university computers, but I would like to know how to do it within the xcode environment.
** EDIT **
Figured it out... just needed to put two dashes before the argument! Thanks again for your help.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.