I have a wierd problem with C. The program that i am writing produces a seg fault when I use fclose on a valid strem. I have traced the code with gdb and the pointer to the strem remains the same throughout the function. And i am able to write to the stream with no problem. Below is the backtrace from gdb. (gdb) bt #0 chunk_free (ar_ptr=0x401cb620, p=0x80573f0) at malloc.c:3180 #1 0x40117bf4 in __libc_free (mem=0x80573f8) at malloc.c:3154 #2 0x40107f75 in _IO_new_fclose (fp=0x80573f8) at iofclose.c:85 #3 0x0804d725 in storeRating__FPfPcifPi (data=0x80573e8, user=0xbffffa50 "u@u.com", jokeid=1, rating=0.825242698, num_rated=0xbffff91c) at hirate_testerb.c:449 #4 0x0804c95e in main () at hirate_testerb.c:110 #5 0x400b3507 in __libc_start_main (main=0x804c7c0 , argc=1, ubp_av=0xbffffb04, init=0x8048b90 , fini=0x804da30 , rtld_fini=0x4000dc14 , stack_end=0xbffffafc) at ../sysdeps/generic/libc-start.c:129 Thanks
|