When I compile my code under Linux x64 (under x86 no warning) I get the following warning warning: format ‘%llx’ expects argument of type ‘long long unsigned int *’, but argument 3 has type ‘off64_t *’ [-Wformat]
my code snippet:
if(maps && mem != -1) {
char buf[BUFSIZ + 1];
while(fgets(buf, BUFSIZ, maps)) {
off64_t start, end;
sscanf(buf, "%llx-%llx", &start, &end);
dump_region(mem, start, end);
}
}
How should I cast it to get no warning?
EDIT:
Should I cast like this?:
sscanf(buf, "%llx-%llx", (long long unsigned int *)&start, (long long unsigned int *)&end);
PRIu64
instead of %llx – Grijesh Chauhansscanf(buf, "%"PRIu64"-%"PRIu64, &start, &end);
? compiles with no warning but the code doesn't work now. – bsteo-
in scanf that is the reason I didn't post an answer.buff
should be as"3223-2254"
– Grijesh Chauhan