Hi, string s = "1001"; we I convert s to an integer? thanks....
string s = "1001";
we I convert s to an integer? thanks.
"Daqian Yang" <ca> wrote in message news:<bvbb56$1c4q$acadiau.ca>...
If I got your question the right way, one possibility is the following
(assuming s is a STL string) :
int i = atoi(s.c_str());
Eric Entressangle <fr> wrote: [/ref]
Since the OP seems to have a string representing a number in binary,
not decimal, strtol() would look like a better choice because it
allows to specify the base. Moreover, it also allows error checking
and thus is usually considered to be preferable over atoi().
\ Jens Thoms Toerring ___ fu-berlin.de