What is atoi equivalent for 64bit integer(uint64_t) in C that works on both Unix and Windows?

前端 未结 7 1510
失恋的感觉
失恋的感觉 2021-02-02 08:02

I\'m trying to convert 64bit integer string to integer, but I don\'t know which one to use.

7条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-02 08:23

    Use strtoull if you have it or _strtoui64() with visual studio.

    unsigned long long strtoull(const char *restrict str,
           char **restrict endptr, int base);
    
    
    /* I am sure MS had a good reason not to name it "strtoull" or
     * "_strtoull" at least.
     */
    unsigned __int64 _strtoui64(
       const char *nptr,
       char **endptr,
       int base 
    );
    

提交回复
热议问题