943,733 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 6756
  • C RSS
Sep 16th, 2003
0

printf buffer strange behaviur

Expand Post »
ok.. it seems like with every step in my program I stuble on more and more unconrprehendable errors.. this time it is with the printf function. When I am printing:
"
fflush (stdout);
puts ("\nOrganized data:");
for (int i=0; i<sdata.width; i++)
printf ("'%s',",sdata.ar[i].name);
puts ("\b");
for (int a=0; a<sdata.rows; a++)
{
for (int b=0; b<sdata.width; b++)
{
printf("%d,",sdata.ar[b].values[a]);
}
puts("\b");
}
"
if I have a printf call that uses that class all works fine but if I don't call it before (at the end I won't get it printed at all since this is internal data, not for user) it showes a bunch of mambo-jambo before and after the printed segment. It seems to be a buffering problem so that is why I used fflush() but that didn't help (mayy be wrong buffer stream?).
Ilya
Similar Threads
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
Valmian is offline Offline
82 posts
since Sep 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: string to integer array transformation
Next Thread in C Forum Timeline: struct dynamic 2d array alloc





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC