Re: Formatted printing (D5.1 and D6)
Posted by
Peter Kenny-2 on
Mar 25, 2006; 9:43pm
URL: https://forum.world.st/Formatted-printing-D5-1-and-D6-tp3378016p3378019.html
Ian
> Have a look at the docs for the c++ implementation at
>
http://www.cplusplus.com/ref/cstdio/sprintf.html I don't think all the
> options will work from Dolphin though.
> Let us know what you are trying to format, and where you are trying to
> format it, and we might be able to help.
>
Thanks for the quick reply. I have followed the link and tried to use the
options I want, but it does not seem to work as I expected. I am not after
anything fancy. I have a table with three columns of floats, and I want to
print each column in an 8 character field with 4 decimal places. As a test I
did:
'%8.4f' sprintfWith: 1.2345
and I got the answer ' 0.0000'. When I changed the '%8.4f' to '%8.4e', it
gave the answer '7.8367e-316', and it gave the same answer if I dropped the
decimal point in the argument and put 12345.
At this point I feel inclined to give up and accept the default output from
Dolphin, even though I can't get the points to line up!
Thanks
Peter