New essay: ToString



So I had to take time to watch the plumbers replace a leaky valve...so I spent the time
writing a little essay on a function called ToString, which takes a formatting string and
arguments and lets you write something like

c_Coordinates.SetWindowText( ToString( _T("(%d,%d)"), pt.x, pt.y) );

note that no intermediate CString variable or FormatString was required. It is so simple
(6 lines of code) that there isn't even a download, you can copy right off the Web page
(it is overloaded so there is a form that takes a UINT which is a STRINGTABLE form, and
that takes a whopping eight lines total!)

Now if I could only get them to help me with my current handle leak...
joe
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: How to format number?
    ... You don't need to create the formatting string, and SetAt is definitely a bad way, and ... >CString Double_To_Char ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: How to format number?
    ... > You don't need to create the formatting string, and SetAt is definitely a ... >>the double you want to format, and the number of significant digits you ... > MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)

Loading