delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/24/10:43:06

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

> 
> 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 <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > 
    [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...

  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019