Index:
[thread]
[date]
[subject]
[author]
From: Robert C. Duvall <rcd@cs.duke.edu>
To :
Date: 15 Feb 1999 15:48:15 -0500
Re: itoa
> Is it defined in the g++ library? If yes, then how to use it (I tried the
> man pages, nothing exists for itoa). If no, then is there a function to
> convert integer to string?
To convert an int to a string, use the function sprintf. For example,
if num is a int in your program:
string numStr;
sprintf(numStr.c_str(), "%d", num);
See the man page on sprintf for more details,
rcd
--
Robert C. Duvall
Lecturer, Duke University
rcd@cs.duke.edu
Index:
[thread]
[date]
[subject]
[author]