Format specifiers for uint8_t, uint16_t, …?

后端 未结 7 1490
执念已碎
执念已碎 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:28

    As others said, include <stdint.h> header that defines the format macros. In C++, however, define __STDC_FORMAT_MACROS prior to including it. From stdint.h:

    /* The ISO C99 standard specifies that these macros must only be
       defined if explicitly requested.  */
    #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
    
    0 讨论(0)
提交回复
热议问题