Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 1998 17:57:06 -0500
From:      MALCOLM BOFF <Malcolm_Boff@compuserve.com>
To:        grobin <grobin@accessv.com>
Cc:        freebsd <freebsd-questions@FreeBSD.ORG>
Subject:   RE: Can't getopt()
Message-ID:  <199802031758_MC2-31CC-D2E8@compuserve.com>

next in thread | raw e-mail | index | archive | help
The standard 'main()' for a C program is :-

int main(int argc, char **argv)
{
    main code ...
}

Now argc and argv are correctly declared ...

I also suspect that the format that you specified is not really what
you want since this will treat each letter as a flag (ie -a -b -c etc)

If you want to be able to pick up something like a file name following
a -f flag then follow the letter with a colon (:) and use a switch()
statement
on the result of getopt().

Malcolm G. Boff
Sylmex Ltd.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802031758_MC2-31CC-D2E8>