February 01, 2001
The New CIntegers, Part 3Randy Meyers
At first glance, C99's new integral types seem to threaten its portability. But a few added headers and typedefs improve the outlook dramatically.
Listing 1: Using string literal concatenation with C99 <inttypes.h> macros to create format specifiers for scanf and printf
#include <stdio.h>
#include <inttypes.h>
int main()
{
int_fast64_t x;
scanf("%" SCNdFAST64, &x);
printf("x=%08" PRIdFAST64 "\n", x);
return 0;
}
End of Listing
|
|
||||||||||||||||||||||||||||
|
|
|
|