delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/28/02:46:22

Xref: news2.mv.net comp.os.msdos.djgpp:6472
From: pengzh AT ix DOT netcom DOT com (PENG ZHOU)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C Program crashes in Djgpp
Date: 24 Jul 1996 13:35:53 GMT
Organization: Netcom
Lines: 69
Message-ID: <4t58rp$i57@dfw-ixnews3.ix.netcom.com>
References: <4t3hfa$p5n AT sjx-ixn6 DOT ix DOT netcom DOT com>
NNTP-Posting-Host: pas-ca10-02.ix.netcom.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In <4t3hfa$p5n AT sjx-ixn6 DOT ix DOT netcom DOT com> pengzh AT ix DOT netcom DOT com(PENG ZHOU)
writes: 
>
>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>
>
>int main(int argc, char **argv)
>{
>  FILE *input;
>  char ch;
>  int arr;
>
>  for ( arr = 0; arr < argc; arr++ )
>  {
>    if ( (strcmp(argv[arr],"-help)==0) || (strcmp(argv[arr],"-h")==0)
)
>    {
>      puts("FileRead.EXE v.1\n");
>      puts("Usage: C>FileRead -file filename.xxx\n");
>      exit(0);
>    }
>
>    if ( (strcmp(argv[arr],"-file)==0) || (strcmp(argv[arr],"-f")==0)
)
>    {
>      input = fopen(argv[arr+1], "r");
>      if ( input == NULL )
>      {
>        puts("Cannot open file!\n");
>        exit(1);
>      }
>    }
>  }
>  
>  while (!feof(input))
>  {
>    ch = getc(input);
>    printf("%c", ch);
>  }
>  fclose(input);
>  return 0;
>}
>
>This program might have a few bugs but it runs ok in MSC, compiles ok
>in DJGPP but crashes when runned.  Any Suggestions?
>
>----
>pengzh AT ix DOT netcom DOT com
>    
>
>
>
>
>
> 
Thank you all for giving me the suggestions about this.  But it seemed
that I've find the problem.  I think it's about the network.  Every
time it is turned on on my Win95 machine the program crashes with some
general protection faults.  Though i've seen some division by zero
faults too, which I don't know.

----
pengzh AT ix DOT netcom DOT com

- Raw text -


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