When compiling with Mingw 32bit, the size of long and unsigned long is 4 bytes, the size of long long and unsigned long long is 8 bytes.
To print a long integer, the format of printf is “%ld”.
To print an unsigned long integer, the printf format is “%lu”.
To printf a long long integer, you should use “%lld” as the format of printf.
To display an unsigned long long integer, the print format string you should use is “%llu”.
If you use “%lu” to display an unsigned long long integer, you may get “0” output, which is not you want.
reference:
https://stackoverflow.com/questions/38561/what-is-the-argument-for-printf-that-formats-a-long
https://stackoverflow.com/questions/2844/how-do-you-format-an-unsigned-long-long-int-using-printf
Posted in
c/c++
Simulate mouse click using jQuery
20,591 views
How is the size of Qt widgets determined?
20,240 views
exit /b in Windows batch script
17,098 views
The difference between %CD% and %~dp0
15,160 views
login with python requests
13,649 views
Communication between C++ and Javascript in Qt WebEngine
12,941 views
How to intercept ajax calls in jQuery?
10,788 views
How to add/insert/remove a row in QTableView?
10,329 views
Show div in one line
9,766 views
How to install python packages ignoring ssl certificate verification?
8,236 views