Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexWoz

macrumors newbie
Original poster
Sep 12, 2009
13
0
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.
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.