| | |
printf buffer strange behaviur
![]() |
•
•
Join Date: Sep 2003
Posts: 81
Reputation:
Solved Threads: 0
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
"
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
- Pass a string by reference (C)
- C and C++ Timesaving Tips (C++)
- Why atof causes a C0000005 exeption? (C++)
- A simple query (C)
- total newb - "passing arg 2 of `strcpy' makes pointer from integer without a cast" (C++)
- stripping digits (C)
Other Threads in the C Forum
- Previous Thread: string to integer array transformation
- Next Thread: struct dynamic 2d array alloc
| Thread Tools | Search this Thread |
#include * adobe ansi array arrays asterisks binarysearch centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram inches include incrementoperators infiniteloop input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux locate looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable voidmain() wab whythiscodecausesegmentationfault windowsapi





