I'm trying to get long long
from the console using standard IO function scanf
. I started with %lld
:
scanf("%lld", &rule);
That throws:
error: unknown conversion type character 'l' in format [-Werror=format=]
I've found more workarounds, but they too throw errors:
scanf("%I64d", &rule);
->error: ISO C does not support the 'I64' ms_scanf length modifier [-Werror=format=]
scanf("%"SCNd64"", &rule);
->error: expected ')' before 'SCNd64'
Am I doing something wrong? Is there an another trick?
I'm compiling on very recent version of MinGw GCC with these flags: -pedantic -Wall -Werror -std=c99 -g -D HOME=1
-std=gnu99
instead of c99.rule
isint64_t
instead, tryscanf("%" SCNd64, &rule);
Be sure to includeinttypes.h
andstdint.h
. See this for more info. It should be supported in C99.-std=c99
is being passed when the first error message is generated?-std=gnu99
yields the same errors.