uint64

difference between stdint.h and inttypes.h

a 夏天 提交于 2019-11-27 19:52:12
问题 What is the difference between stdint.h and inttypes.h? If none of them is used, uint64_t is not recognized but with either of them it is a defined type. 回答1: See the wikipedia article for inttypes.h. Use stdint.h for a minimal set of definitions; use inttypes.h if you also need portable support for these in printf, scanf, et al. 回答2: stdint.h Including this file is the "minimum requirement" if you want to work with the specified-width integer types of C99 (i.e. "int32_t", "uint16_t" etc.).

sprintf for unsigned _int64

醉酒当歌 提交于 2019-11-27 09:13:39
I am having following code. output of second %d in sprintf is always shown as zero. I think i am specifying wrong specifiers. Can any one help me in getting write string with right values. And this has to achieved in posix standard. Thanks for inputs void main() { unsigned _int64 dbFileSize = 99; unsigned _int64 fileSize = 100; char buf[128]; memset(buf, 0x00, 128); sprintf(buf, "\nOD DB File Size = %d bytes \t XML file size = %d bytes", fileSize, dbFileSize); printf("The string is %s ", buf); } Output: The string is OD DB File Size = 100 bytes XML file size = 0 bytes DevSolar I don't know

sprintf for unsigned _int64

可紊 提交于 2019-11-26 14:27:43
问题 I am having following code. output of second %d in sprintf is always shown as zero. I think i am specifying wrong specifiers. Can any one help me in getting write string with right values. And this has to achieved in posix standard. Thanks for inputs void main() { unsigned _int64 dbFileSize = 99; unsigned _int64 fileSize = 100; char buf[128]; memset(buf, 0x00, 128); sprintf(buf, "\nOD DB File Size = %d bytes \t XML file size = %d bytes", fileSize, dbFileSize); printf("The string is %s ", buf)