From owner-freebsd-questions Fri Feb 6 01:50:46 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA09968 for questions-outgoing; Fri, 6 Feb 1998 01:50:46 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dub-img-6.compuserve.com (dub-img-6.compuserve.com [149.174.206.136]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA09963 for ; Fri, 6 Feb 1998 01:50:40 -0800 (PST) (envelope-from Malcolm_Boff@compuserve.com) Received: (from root@localhost) by dub-img-6.compuserve.com (8.8.6/8.8.6/2.10) id EAA02046; Fri, 6 Feb 1998 04:49:36 -0500 (EST) Date: Fri, 6 Feb 1998 04:49:05 -0500 From: MALCOLM BOFF Subject: RE: Can't getopt() To: freebsd-questions Cc: Doug Message-ID: <199802060449_MC2-3226-6A90@compuserve.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="07522c83-9ed2-11d1-b22e-00805feabca1" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe questions" This is a MIME-encapsulated message --07522c83-9ed2-11d1-b22e-00805feabca1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Malcolm G. Boff Sylmex Ltd. --07522c83-9ed2-11d1-b22e-00805feabca1 Content-Type: text/plain; charset=ISO-8859-1; name="doug.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="doug.txt" =0D =0D On Tue, 3 Feb 1998, Doug White wrote:=0D =0D >> The program below should print the first command line argument but whe= n=0D >> I try to compile it I get the errors 'argc' undeclared and 'argv'=0D >> undeclared. =0D >=0D >Forget your C text? :)=0D >=0D >> main()=0D >=0D >The proper declaration should be =0D >=0D >void=0D >main(int argc, char** argv)=0D >=0D >argc is the number of arguments, argv is the string of arguments.=0D >=0D >change void to int and return(0) at the end if you want to be all proper= =0D >UNIXlike.=0D =0D My only comment to this would be that if you really want to be both=0D 'C' like and 'UN*X' like then DON'T use 'return(0)' in 'main' function=0D= use 'exit(0)' which does considerably more than 'return' which is simply=0D= a stack popper.=0D --07522c83-9ed2-11d1-b22e-00805feabca1--