Plz Help
See the following links for information:
http://www.cplusplus.com/ref/cstdlib/fcvt.html
http://www.cplusplus.com/ref/cstdlib/gcvt.html
--hellz
[edited by - hellz on September 2, 2003 12:22:16 PM]
http://www.cplusplus.com/ref/cstdlib/fcvt.html
http://www.cplusplus.com/ref/cstdlib/gcvt.html
--hellz
[edited by - hellz on September 2, 2003 12:22:16 PM]
Err... no.
If the OP meant to a
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on September 2, 2003 1:46:58 PM]
If the OP meant to a
char*
/character array, and they are therefore using C, sprintf()
should be used. If you are using C++, string stream(s) should be used. On the other hand, if you did actually mean to a char
, a char
is an integral type, and so you could use casts, but there would be losses in precision, and I doubt you actually meant char
in the first place. [ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on September 2, 2003 1:46:58 PM]
quote:Original post by Lektrix
Err... no.
If the OP meant to achar*
/character array, and they are therefore using C,sprintf()
should be used. If you are using C++, string stream(s) should be used. On the other hand, if you did actually mean to achar
, achar
is an integral type, and so you could use casts, but there would be losses in precision, and I doubt you actually meantchar
in the first place.
Hmm, you''ve got a point there actually. Never really used sprintf() for that (purely as it hasn''t come about yet, although I''m sure it will ).
Click for info. on sprintf()
--hellz
Have a search on Google for string streams, i.e. a search term such as "C++ stringstream". Also, is there some particular reason why you are using C-style strings, as opposed to C++ strings (
I would recommend using
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on September 2, 2003 5:43:16 PM]
std::string
)?I would recommend using
boost::lexical_cast
. It's quite a compact function, and is nice and generic - templated basic_streamstring
, and so forth. [ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on September 2, 2003 5:43:16 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement