c - scanf a big hexadecimal value -
i have issue trying use scanf big hexadecimal num (12 chars) user.
it seems last 8 chars, eg - abffffffff become 0000ffffffff.
this code -
unsigned long long address; scanf("%x",&address); printf("address: %#014x", address);
for input: "abffffffff" output be:
address: 0x0000ffffffff
i have tried playing bit scanf format, no avail.
thank you.
you must use "%llx" both scanf format , printf. see manual page additional details.
Comments
Post a Comment