home *** CD-ROM | disk | FTP | other *** search
- Path: news.brandonu.ca!menon
- From: menon@beijing.brandonu.ca
- Newsgroups: comp.sys.amiga.programmer
- Subject: My code crashes my computer
- Date: 17 Mar 1996 09:29:41 GMT
- Organization: Brandon University
- Message-ID: <4igm25$poj@goofy.BrandonU.CA>
- NNTP-Posting-Host: beijing.brandonu.ca
- Originator: menon@beijing.brandonu.ca
-
- This is an except from my program which shows where it crashes
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
-
- .
- .
- .
-
- /***** READ_FILE *****/
- void read_file(char *infile, char *infile2){
- int i=0, x, y, garb;
- FILE *fp;
- char *s="File Error";
- char *comment="", buf;
-
- fp = fopen(infile, "r");
- if (fp==NULL){
- printf("FAILED!\n");
- perror(s);
- exit(1);
- }
- fgets(type,3,fp);
- fscanf(fp,"%s",comment);
- if (comment[0]=='#'){
- do{
- fscanf(fp, "%s",comment);
- sprintf(buf,"%d",atoi(comment)); <---Crashes Here
- }
- while (strcmp(comment,buf));
-
- I compile it using:
- gcc -o corr corr.c -m68040 -m68881
-
- If anyone can help me, I would greatly appreciate it.
-
- -Vivek A. Menon
- --
- ____________________________________________________________________________
- Vivek A. Menon, B.Sc. 4th year Comp.Sci./Geography
- menon@beijing.brandonu.ca Brandon University
- Amiga 4000/040
-