|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++.dos - problem with printf output of carriage return (\r)
I have legacy code from Borland C++ v5.xx that usese
the format:
printf("\n\rheader of information\n\r");
while(ok) {
printf(\r%6i itterations", ii++);
...
}
I get a CR/LF for the \r output.
Instead of a CR only.
Using DMC v8.29n "-mtd" compile to .com option.
Any help appreciated
ajax4hire8c hotmail.com
Oct 21 2002
Looks like you need to set stdout to binary, not text, mode. Try:
stdout->_flag |= _F_BIN;
"Digital Mars C/C++ Compiler" <Ajax4Hire8C hotmail.com> wrote in message
news:ap0mo4$ok5$1 digitaldaemon.com...
Oct 21 2002
problem in coding.
ran simple test to confirm both LF & CR/LF output.
worked as expected.
re-examined original code.
I was outputing a line >80 characters so line would wrap to newline.
re-worked the printf to output less than 80 characters, expected output.
Thanks for the quick response.
details of printf and change..
printf("\r%7s%9s %6u %-64s" , cItemREF, cItemSAN, iItemNum,
cItemDes); }
changed to:
printf("\r%7s%9s %6u %-32.32s" , cItemREF, cItemSAN, iItemNum,
cItemDes); }
original printf sent space-padded text beyond column 80; force stdio to wrap
to newline.
corrected printf limits the line to less than 80 to get expected results.
"Walter" <walter digitalmars.com> wrote in message
news:ap17t0$1buv$1 digitaldaemon.com...
Oct 21 2002
|