[SOLVED] 64 bits standard lib functions (like atoi) ?

I have to deal with values going from 34 bits to 42 bits and convert strings of such values into u_int64_t. It seems that the standard library with its atoi or atol or atoul functions are limited to 32 bits values.

I don't undestand why now we have had 64 bits processors for some years, we still don't have 64 bits versions of these functions.

Is it a mistake from mine ?
Last edited on
closed account (zwA4jE8b)
you could write your own atoi function, there are some source on the web for such functions, im sure you could convert them to use 64 bit numbers.

koders.com has lots of source, but using google you can find other examples.
Last edited on
Thanks CreativeMFS, but that was not the question. I wrote already what I need. The questions are :
1) can you confirm it does not exist in the standard ?
2) if yes, why on the hell isn't it in the standard ?
> now we have had 64 bits processors for some years, we still don't have 64 bits versions of these functions.

We do have them now: std::strtoll() and std::strtoull() in <cstdlib>
http://en.cppreference.com/w/cpp/string/byte/strtoul

C99 has had them for years:
http://www.freebsd.org/cgi/man.cgi?query=strtoull&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html
closed account (o1vk4iN6)
I love how descriptive the content in that link is:

char** str_end - pointer to a pointer to character.


It's only stating the obvious.
Last edited on
Read all of it. It also has:
The functions sets the pointer pointed to by str_end to point to the character past the last character interpreted. If str_end is NULL, it is ignored.


Says everything that needs to be said about str_end.
Thanks very much.
Topic archived. No new replies allowed.