Convert string

Hello to all,

I have a string named str and I want to convert this string to an uint64_t name t.
Can someone advise me.

Regards
CMarco
Hi,

I know that atoi converts const char *string to a integer with 32-bits... but to uint64_t this do not work...
You can use std::istringstream.
1
2
std::istringstream iss(str);
iss >> t;

or in one line
1
2
std::istringstream(str) >> t;
Hi,

I find this, works also:

unsigned long strtoul(const char *nptr, char **endptr, int base);

and works in C and C++.

@Peter87:thanks...

Regards,
CMarco
Topic archived. No new replies allowed.