Daniel
What language (C, C++, C#, VB, other) are you using? In C/C++, you
can use sprintf. I'm not a mindreader, so the more information you
provide, you can help others help you.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Assuming C/C++:
As Nathan said, sprintf( ) but to be more safe use sprintf_s( )
You can also look at _itoa_s( )
Regards,
Ron Francis
www.RonaldFrancis.com
Daniel:
and std::ostringstream.
--
David Wilkinson
Visual C++ MVP
"Nathan Mates" <nat...@visi.com> wrote in message
news:GoednRYIfbfkLtDVnZ2dnUVZ_siknZ2d@visi...
CString cs;
cs.Format(_T("%d"),nIntVal);
You can also use itoa(), but it's more work.
Tom
"Daniel" <Mah...@cableone.net> wrote in message
news:uJusPBoy...@TK2MSFTNGP04.phx.gbl...
Wrong. There is no such language. If you mean C, the answer will be
different than for C++, at least because they use different ways to
represent and handle strings. If you use C#, the answer will differ even
more. Even if you use C++, the answer will be different if you use the MFC
instead of the C++ standardlibrary. Anyway, google for "convert int string
<yourlanguage>" and you will find lots of answers.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
I agree with Tom.
You may define a function to wrap Tom's code (that is what I use to do):
<code>
// Converts from integer to string
inline CString ToString( int n )
{
CString s;
s.Format( _T("%d"), n );
return s;
}
</code>
And in your code you can just write:
int n;
int m;
...
CString msg;
msg = _T("N = ") + ToString( n );
msg += _T("M = ") + ToString( m );
...
Giovanni
Tom
"Giovanni Dicanio" <giovanni...@invalid.com> wrote in message
news:e$ATf9tyI...@TK2MSFTNGP02.phx.gbl...
Yes Tom.
...But it seems that we in the C++ world like to build things by ourselves
;-)
G
template< typename T >
inline
std::string convert2str(const T& obj)
{
std::ostringstream oss;
oss << obj;
return oss.str();
}
> Daniel
Schobi