[LC++]getopt question

Carlo Wood carlo at alinoe.com
Mon Nov 18 18:51:01 UTC 2002


Don't call getopt on it.

You can either make it an argument of an option, ie
 --date 2002-11-17
Or you can decide to interpret it as a date because
the first character is not a '-' and then start
treating everything after it as non-options too.

On Mon, Nov 18, 2002 at 12:17:50AM -0500, Paul M Foster wrote:
> I'm using getopt(3) to obtain command line parameters for a program I've
> written. One of the parameters is in the form of a date, to wit:
> 
> 2002-11-17
> 
> Apparently, getopt() sees those dashes and interprets them as more
> options. It stops and waits for me to type in something. If I take out
> this option, the program runs fine. I've tried quoting the string,
> double-quoting the string, escaping the dashes with backslashes. Nothing
> appears to work. Anyone have any experience with a way to get around
> this?
> 
> Paul

-- 
Carlo Wood <carlo at alinoe.com>



More information about the tuxCPProgramming mailing list