Mail Archives: djgpp/1996/07/24/10:43:06
>
> 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 -