From owner-freebsd-questions Mon Feb 2 10:51:41 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA10950 for questions-outgoing; Mon, 2 Feb 1998 10:51:41 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from emerald.accessv.com (emerald.accessv.com [206.221.248.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA10945 for ; Mon, 2 Feb 1998 10:51:36 -0800 (PST) (envelope-from grobin@accessv.com) Received: from accessv.com (port065-87.accessv.com [209.50.87.65]) by emerald.accessv.com (8.8.5/8.8.5) with ESMTP id NAA30248 for ; Mon, 2 Feb 1998 13:48:07 -0500 Message-ID: <34D6150D.2FD35180@accessv.com> Date: Mon, 02 Feb 1998 13:48:45 -0500 From: Geoffrey Robinson Reply-To: grobin@accessv.com X-Mailer: Mozilla 4.03 [en] (Win95; U) MIME-Version: 1.0 To: questions@FreeBSD.ORG Subject: Can't getopt(). Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe questions" 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 #include 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.