RE: [Dev-C++] convert 'int' to 'char'/'str'
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-11-12 16:48:53
|
Use std::ostringstream as described in my first mail. /Per W On Fri, 12 Nov 2004, Guillermo Gutierrez wrote: > Thanks you everyone who responded so quickly, looks like sprintf() is the best/easiest way to go. > > Question: has anyone ever tried this with the 'string' class (#include <string>)? > > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Friday, November 12, 2004 8:31 AM > To: Cary Haynie > Cc: Guillermo Gutierrez; dev...@li... > Subject: Re: [Dev-C++] convert 'int' to 'char'/'str' > > > Note that itoa() isn't defined in ANSI-C, so it isn't always available. > > Same with ecvt(), fcvt(), gcvt() for floating point numbers. > > In most situations, sprintf() is a really excellent alternative. Since the > numbers have limited digit count, there shouldn't be a problem with buffer > overflow. > > /Per W > > On Fri, 12 Nov 2004, Cary Haynie wrote: > > > itoa() look in stdlib.h > > > > > > On Fri, 12 Nov 2004 07:54:11 -0800, Guillermo Gutierrez > > <ggu...@ma...> wrote: > > > > > > > > > Is there an easy to convert a numeric value (int, double, etc...) into a > > > char or string? > > > something that would work similar to Delphi's 'IntToStr()' function? > > > > > > Guillermo Gutierrez > > > Market Scan Information Systems > > > Software Q.A. Supervisor > > > (818) 575-2000 x2427 > > > ggu...@ma... > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: > > Sybase ASE Linux Express Edition - download now for FREE > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > ---------------------- |