[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problems with gcc and fopen() in debian 2.2



are you sure you have the right permitions? if you dont, or there is some
other problem, the file  isnt opened and your code still assumes it is.
do somethng like
if ( !( infile = fopen(sdgjflgfdf) ) ) abort();
Dont trust the system :-)

On Wed, 8 Aug 2001, Andreas Maresch wrote:

> Hello!
> 
> I am (re)starting in programming c (I have learned it a while ago under
> dos).
> Yesterday, I wrote a simple program.
> When compiled with gcc -o test test.c, no errors or warnings occured.
> 
> But when I try to run, it terminates with "Segmentation fault".
> So, with the help of ddd (real nice tool ;-D ) I was able to locate the
> problem: fopen().
> 
> ddd reported a seg fault on the following line:
> 
> infile=fopen("dir.dat", "r");
> 
> The "dir.dat" exists (in the same directory), and infile was deklared with:
> FILE *infile;
> 
> My gcc-version is 2.95.
> 
> 
> Thanx in advance
> 
> Andreas Maresch
> 
> 
> BTW: Is it possible to attach files to the newsletter? I donīt suppose so,
> but if I am wrong, please let me know.
> 
> -- 
> -- 
> The checkbox said "Windows 95 or better".
> 
> So I installed Linux!
> 
> Aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne
> Einrichtungsgebuehr + 1 Monat Grundgebuehrbefreiung!
> http://puretec.de/index.html?ac=OM.PU.PU003K00736T0492a
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 



Reply to: