Mail Archives: djgpp/1998/07/06/17:45:25
Destination: "Bradley A. Barrett" <bbarrett AT isr DOT umd DOT edu>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Mon, 6 Jul 1998 12:10:40 -0400:
>
>Alain Rosenthal wrote in message <359B9A42 DOT 3B9F AT hyperman DOT co DOT il>...
>
>>-3: the function feof() seems to provoke an error:
>[...]
>>Under DOS gcc it works fine
>>Compiled with -Zwin32 -Zrsx32 , it produces an error!
>
>
>I have encountered the same problem. The following code works fine when
>compiled as a DJGPP DOS program, but crashes at the first feof(infile) call
>with "Exception at 0x00000000; Application got SIGSEGV" when compiled
>with -Zwin32:
>
>#include <stdio.h>
>#include <stdlib.h>
>main (int argc, char *argv[])
> {
> int c;
> FILE *infile;
> infile=fopen(argv[argc-1],"r"); {
This should read
if((infile=fopen(argv[argc-1],"r")) == NULL) {
>Does anyone know why this happens? Is my RSXNTDJ installation not
>configured right?
I think that this may be your problem depending on what you give on the
commandline. When you can't open the file than this will crash. If there is no
parameter given on the commandline this would open the program that you
execute. Don't know if you want this behaviour. If not then you should check
argc for correctness prior to using it this way.
--
Bye,
Gerhard
email: sparhawk AT eunet DOT at
g DOT gruber AT sis DOT co DOT at
Spelling corrections are appreciated.
- Raw text -