Re: segmentation fault with fclose
Try the "comp.lang.c.moderated" group for C and C library questions. You probably meant: if( fp != NULL ) fclose( fp ); That is, "!= NULL" rather than "== NULL".
Re: segmentation fault with fclose
On 20 March 2011 22:47, bd satish wrote: > Hi, > > I'm trying to close a file using fclose, but the following program seg-faults: > > > #include > > int main(void) > { > FILE* fp = fopen("unfounded.txt", "r"); > > if(fp == NULL) > fclose(fp); > > return 0; > } > > > The file I'm tr