Date: Mon, 02 Feb 1998 13:48:45 -0500 From: Geoffrey Robinson <grobin@accessv.com> To: questions@FreeBSD.ORG Subject: Can't getopt(). Message-ID: <34D6150D.2FD35180@accessv.com>
next in thread | raw e-mail | index | archive | help
I probably shouldn't keep posting my C questions to this list but I'm
stumped on this command and don't know anybody who can help.
The program below should print the first command line argument but when
I try to compile it I get the errors 'argc' undeclared and 'argv'
undeclared. I've been through the getopt man page dozens of times but I
can't see where it shows how to declare argc and argv. So if they're not
defined in stdlib.h I don't know where they come from.
#include <stdio.h>
#include <stdlib.h>
main()
{
extern char *optarg;
extern int optind;
int ch = 0;
ch = getopt(argc, argv, "abcdefghijklmnopqrstuvwxyz");
printf ("%c\n",ch);
}
At this point I'm so frustrated with this I would be happy with a way of
just getting the command line arguments as a single string and decode
them myself.
Thanks.
--
Geoffrey Robinson
grobin@accessv.com
Oakville, Ontario, Canada.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34D6150D.2FD35180>
