Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CString.Format() with double

671 views
Skip to first unread message

Guido Franzke

unread,
Aug 6, 2009, 11:27:24 AM8/6/09
to
Hello NG,

I write a double in a CString:

double f =10.5;
CString s1,s2;
s1.Format("%.2f", f);
s2.Format("%.2lf", f);

On some computers, we have in s1 and s2 the same "10.50".
On others (german Win XP), I can see in s2 sometimes "10,00" (so it cuts
f's .5)
Why is it?

I use MS Visual C++ 2003, V7.1.

Thanks for help,
Guido


xrxst32

unread,
Aug 7, 2009, 1:18:28 AM8/7/09
to

I tried it and I can't confirm that. Results in the same "10.50" in
both cases. Maybe something's else going on in other code. Please
create a minimal programm which reproduces the problem.

I'm using
- WinXP Pro German
- VS2003 SP1

Guido Franzke

unread,
Aug 7, 2009, 7:41:58 AM8/7/09
to
I found a problem with setlocale, that is called later. I come back to my
old code and see german style.
Thanks for your time to check.
Regards,
Guido

"xrxst32" <ibd.dan...@daimler.com> schrieb im Newsbeitrag
news:d949b119-f143-44ff...@q35g2000vbi.googlegroups.com...

0 new messages