Mailinglist Archive: opensuse (1046 mails)
| < Previous | Next > |
Re: [opensuse] Need help with using cruses in c program
- From: Cristian Rodríguez <crrodriguez@xxxxxxxxxxxx>
- Date: Thu, 10 Mar 2011 19:46:07 -0300
- Message-id: <4D7954AF.4070909@opensuse.org>
El 10/03/11 19:32, Terry Eck escribió:
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@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
On 03/10/2011 11:59 AM, Cristian Rodríguez wrote:
the programI added writes to the program. This is the output:
#gdb yourprogram
(gdb) run
(gdb) bt full
post your result to the list.
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@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |