How to convert program parameter from argv
to int64_t
? atoi()
is suitable only for 32 bit integers.
C – How to Convert String to int64_t
c++int64unix
c++int64unix
How to convert program parameter from argv
to int64_t
? atoi()
is suitable only for 32 bit integers.
Best Answer
There are a few ways to do it:
This is POSIX C99 compliant.
you can also use strtoimax; which has the following prototype:
This is nice because it will always work with the local intmax_t ... This is C99 and you need to include
<inttypes.h>