|
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++.windows.32-bits - wsprintf with floats
How do I use wsprintf with a float? I tried %f but it just printed f If i use %i it cuts off the decimal... Steve De Chellis Jul 03 2002
%g for floats, %d for integers. -Walter "Steve & Denise De Chellis" <dbouton snet.net> wrote in message news:afvcvu$26q7$1 digitaldaemon.com...How do I use wsprintf with a float? I tried %f but it just printed f If i use %i it cuts off the decimal... Steve De Chellis Jul 03 2002
wsprintf (szBuffer, TEXT ("c %g "), fEncumb);
SetDlgItemText (hDlg, 28, szBuffer);
That is the code I tried but in the Dialog I end up with "c g"
Steve
"Walter" <walter digitalmars.com> wrote in message
news:afvo5v$2hge$1 digitaldaemon.com...
Jul 03 2002
Changing it to sprintf did work though.... Anyone know why? Steve De Chellis "Steve & Denise De Chellis" <dbouton snet.net> wrote in message news:ag0auc$25p$1 digitaldaemon.com... Jul 03 2002
Try replacing TEXT("c %g") with L"c %g".
"Steve & Denise De Chellis" <dbouton snet.net> wrote in message
news:ag0isj$aq9$1 digitaldaemon.com...
Jul 03 2002
Guys Maybe I've missed something all these years, but I never thought that wsprintf handled floating point. The help for wsprintf certainly does not mention any floating point format sequences. Matthew "Walter" <walter digitalmars.com> wrote in message news:ag0k94$bu6$1 digitaldaemon.com... Jul 03 2002
It should work just like sprintf, but for wchar's. "Matthew Wilson" <matthew thedjournal.com> wrote in message news:ag0lbp$d39$1 digitaldaemon.com...Guys Maybe I've missed something all these years, but I never thought that wsprintf handled floating point. The help for wsprintf certainly does not mention any floating point format sequences. Matthew Jul 04 2002
Walter, No offense, but I think you're getting mixed up with swprintf - the wide version of sprintf - which is an ANSI function. Steve is talking (as am I) about wsprintf - the USER32 sprintf replacement (apart from floating points) - which is a shorthand for all those people (wise souls, at least when using MSVC) who do not wish to link to the C-runtime libaries. Neither the ANSI (wsprintfA) or Unicode (wsprintfW) versions use floating points, I'm afraid Matthew "Walter" <walter digitalmars.com> wrote in message news:ag0vqq$o8r$1 digitaldaemon.com...It should work just like sprintf, but for wchar's. "Matthew Wilson" <matthew thedjournal.com> wrote in message news:ag0lbp$d39$1 digitaldaemon.com...Guys Maybe I've missed something all these years, but I never thought that wsprintf handled floating point. The help for wsprintf certainly does Jul 05 2002
Oh, I think you're right. My goof! I always have to stop and think if it's sw or ws. Argh. "Matthew Wilson" <matthew thedjournal.com> wrote in message news:ag3g4m$5dc$1 digitaldaemon.com...Walter, No offense, but I think you're getting mixed up with swprintf - the wide version of sprintf - which is an ANSI function. Steve is talking (as am I) about wsprintf - the USER32 sprintf replacement (apart from floating points) - which is a shorthand for all those people (wise souls, at least when using MSVC) who do not wish to link to the C-runtime libaries. Jul 05 2002
No worries. I guess I'm more attuned only because I chronically spend so much effort in avoiding M$'s C-runtime library ... "Walter" <walter digitalmars.com> wrote in message news:ag4kcs$1bdq$2 digitaldaemon.com...Oh, I think you're right. My goof! I always have to stop and think if it's sw or ws. Argh. "Matthew Wilson" <matthew thedjournal.com> wrote in message news:ag3g4m$5dc$1 digitaldaemon.com...Walter, No offense, but I think you're getting mixed up with swprintf - the wide version of sprintf - which is an ANSI function. Steve is talking (as am Jul 09 2002
In article <afvcvu$26q7$1 digitaldaemon.com>, Steve & Denise De Chellis says...How do I use wsprintf with a float? I tried %f but it just printed f If i use %i it cuts off the decimal... Steve De Chellis May 08 2006
This forum is dead, but thanks for the tip. Feb 14 2007
|