Format specifiers for uint8_t, uint16_t, …?

后端 未结 7 1530
执念已碎
执念已碎 2020-11-30 20:26

If I have an integer variable I can use sscanf as shown below by using the format specifier %d.

sscanf (line, \"Value of integer: %d\\n\", &         


        
7条回答
  •  一个人的身影
    2020-11-30 21:08

    The right format to read a uint64_t (typedef unsigned long long int) is, with scanf and not sscanf, "%" SCNu64 and for print is also SCNu64 Example. in your code you read for example my_integer variable, then you do scanf ("Value of integer:%" SCNu64, & my_integer); and to write the same but with printf.

提交回复
热议问题