From: combee AT cambridge DOT scr DOT slb DOT com (Leendert Combee) Message-Id: <9607241438.AA09829@cambridge.scr.slb.com> Subject: Re: C Program crashes in Djgpp (fwd) To: djgpp AT delorie DOT com Date: Wed, 24 Jul 1996 15:35:42 +0100 (BST) Cc: pengzh AT ix DOT netcom DOT com, r DOT jaycocks1 AT lut DOT ac DOT uk Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > > PENG ZHOU wrote: > > > > Hi, > > My program fileread.c which works ok with my MSC but crashes with > > some general protection faults in DJGPP. Don't know why. > > > > --------------------FileRead.c---------------------- > > #include > > #include > > #include > > [stuff deleted] > > { > > if ( (strcmp(argv[arr],"-help)==0) || (strcmp(argv[arr],"-h")==0) ) > > { [stuff deleted] > > > > if ( (strcmp(argv[arr],"-file)==0) || (strcmp(argv[arr],"-f")==0) ) > > { [stuff deleted] > > Apart from the points I mentioned above, I cannot see any other errors. > > Robert > At least use -Wall. Using gcc under unix, the code does not even want to compile. Simple reason is an obvious error: >> if ( (strcmp(argv[arr],"-help)==0) || (strcmp(argv[arr],"-h")==0) ) ^^^^^^ should be, of course, if ( (strcmp(argv[arr],"-help")==0) || (strcmp(argv[arr],"-h")==0) ) ^^^^^^^ There is another similar occasion of this. I dont know why djgpp compiles, as it should not. With these changes it compiles fine and runs...