From: "Ingo Ruhnke" Newsgroups: comp.os.msdos.djgpp Subject: Re: Need some help ! When I try to read a file it says SIGSEGV error Date: 19 Oct 1997 19:22:02 GMT Organization: Telemedia News Server Lines: 46 Message-ID: <01bcdcc9$456adde0$0200a8c0@ingo> References: NNTP-Posting-Host: gtso-m71-251.pool.mediaways.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Houska Ludek - IN schrieb im Beitrag > Recently I downloaded the DJGPP. When I try to read simple file it says > only SIGSEGV error. ( I use fscanf( file, "%d", &number ) and the file looks > like this : > 3 1 2 2 2 2 > > - only numbers, the program runs through the cycle( read one number ) two > times, and then it crashes. The value from the file doesn't even get into > the variable. Did you opened the file correctly? If not try this: #include int main() { FILE *in; int number; if ((in = fopen("num.txt", "r")) == NULL) { printf("file not found\n"); return 1; } while(fscanf(in, "%d", &number) == 1) { printf("%d ", number); } putchar('\n'); fclose(in); return 0; } This worked fine on my system Ingo -- Ingo Ruhnke eMail: ruhnke AT owl-online DOT de www: http://www.geocities/SiliconValley/Horizon/2159