Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

COMMAND LINE ARGUMENTS

Name: Anonymous 2007-08-04 20:01 ID:emGOLTl7

Why an array of strings? Why not just a single string? You're going to have to do some parsing anyway.

Name: Anonymous 2007-08-05 8:37 ID:zppIgQaE

I don't know about you guys, but my argument handling looks something like:

for (int i = 0; i < c; i++)
{
    if (strmp(argv[i], "-i") == 0)
    {
        // do something for -i
    }
    else if (strmp(argv[i], "-x") == 0)
    {
        // do something for -x
    }
    else
    {
        // do something with the single arg
        // normally filename
    }
}

Parsing is something totally different and I know I build compilers for a living. ;-)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List