Topic: String To Int.
Author: "Adam Wilkshire" <adamant@euronet.nl>
Date: 1998/09/09 Raw View
I know C has a string to int function, but is there any string to int
functions for the standard C++ string class ??
What I do is just put the string into an istrstream and read into an int,
but is this efficient ??
Adman.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Edward Diener <eddielee@abraxis.com>
Date: 1998/09/10 Raw View
#include <sstream>
int result;
std::istringstream iss("33");
iss >> result;
Adam Wilkshire wrote:
> I know C has a string to int function, but is there any string to int
> functions for the standard C++ string class ??
> What I do is just put the string into an istrstream and read into an int,
> but is this efficient ??
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]