C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The itoa function can not be used in g++,right?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
jack
Guest





PostPosted: Wed Feb 23, 2005 4:29 pm    Post subject: The itoa function can not be used in g++,right? Reply with quote



I try to use this function in g++,I have include the head file
'cstdlib' and 'stdlib.h',but it still can not be recognized by
compiler? Anyboday knows what is wrong? or Is there a substitution for
this function.
thanks

Back to top
Eric Lilja
Guest





PostPosted: Wed Feb 23, 2005 5:22 pm    Post subject: Re: The itoa function can not be used in g++,right? Reply with quote




"jack" wrote: news:1109176146.819886.266000 (AT) l41g2000cwc (DOT) googlegroups.com...
Quote:
I try to use this function in g++,I have include the head file
'cstdlib' and 'stdlib.h',but it still can not be recognized by
compiler? Anyboday knows what is wrong? or Is there a substitution for
this function.
thanks


It's a non-standard function, offered as a compiler extension on some
systems. Fortunately, you can easily reproduce its behaviour using
stringstreams. If you should happen to code C sometime and you need the
functionality of itoa() you can reproduce its behaviour using sprintf().
That won't be as safe as the C++ version, though, so always use
stringstreams with C++ instead of sprintf().

/ Eric



Back to top
Victor Bazarov
Guest





PostPosted: Wed Feb 23, 2005 5:26 pm    Post subject: Re: The itoa function can not be used in g++,right? Reply with quote



jack wrote:
Quote:
I try to use this function in g++,I have include the head file
'cstdlib' and 'stdlib.h',but it still can not be recognized by
compiler? Anyboday knows what is wrong? or Is there a substitution for
this function.

There is no substitution. Use 'sprintf' or look around on the web for
'toString' function or something of that sort.

Back to top
jack
Guest





PostPosted: Sat Feb 26, 2005 4:27 pm    Post subject: Re: The itoa function can not be used in g++,right? Reply with quote

thank you!

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.