delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/06/17:45:25

From: sparhawk AT eunet DOT at (Gerhard Gruber)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Win32: RSXNTDJ works but here are some bugs(?)
Date: Mon, 06 Jul 1998 20:36:18 GMT
Organization: Customer of EUnet Austria
Lines: 46
Message-ID: <35a62014.1998038@news.Austria.EU.net>
References: <359B9A42 DOT 3B9F AT hyperman DOT co DOT il> <6nqsrm$aqe AT dailyplanet DOT wam DOT umd DOT edu>
NNTP-Posting-Host: e188.dynamic.vienna.at.eu.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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