El 10/03/11 19:32, Terry Eck escribió:
On 03/10/2011 11:59 AM, Cristian Rodríguez wrote:
the program
#gdb yourprogram (gdb) run (gdb) bt full
post your result to the list.
I added writes to the program. This is the output:
level 0 level 1 level 2 level 2.1 level 2.1a 74
Program received signal SIGSEGV, Segmentation fault. 0xb7e50158 in vfprintf () from /lib/libc.so.6 (gdb)
The following is a segment of the code with problems. Appears to have a problem with fprintf.
/* ------------------------------------------------------------------ */ put_sort() /* ------------------------------------------------------------------ */ { puts("level 2.1"); fi = fopen("account.srt", "w+"); puts("level 2.1a"); printf("%d\r\n",max_record); fprintf(fi,"%d\r\n",max_record); puts("level 2.1b"); i=1; while (i <= 16)
ok, in case you are pointing to the right code, this crashes. "fprintf(fi,"%d\r\n",max_record);" is "fi" a valid file pointer... ? put after fi = fopen("account.srt", "w+"); if(fi == NULL) perror("Error WTF!"); Looks like there is some lazy-ass code there, there is no error checking whatsoever... ;-) and just seeing the firsts bits Im afraid it doesnt quite do what you expect.. HTH. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org