Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Converting in C++ (http://www.programmingforums.org/showthread.php?t=8605)

titaniumdecoy Feb 26th, 2006 9:16 PM

Converting in C++
 
How do you convert strings to ints or ints to strings in C++?

Also, where can I look for similar methods, such as double to string? Is there a standard reference for C++ methods? How do you find methods you didn't know about?

Thanks for the help.

Cache Feb 26th, 2006 9:20 PM

Using stingstream:

http://www.cplusplus.com/ref/iostrea...ingstream.html

titaniumdecoy Feb 26th, 2006 10:58 PM

That seems kind of complicated... isn't there an easy way to do it?

Jimbo Feb 26th, 2006 11:26 PM

you could probably get by with atoi() and itoa() and their family of functions
atoi
itoa
(these are the Microsoft functions, you might need something else for other platforms...)

nnxion Feb 27th, 2006 2:56 AM

Actually using stringstream is a very elegant way of doing it.
Basic input & output for a small intro.


All times are GMT -5. The time now is 4:31 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC