summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@gmail.com>2013-09-15 11:34:12 +0200
committerLudovic Pouzenc <lpouzenc@gmail.com>2013-09-15 11:34:12 +0200
commit5b504426f4548ef8a5035284637dae45f9796dec (patch)
tree90a84d47fe53600b05503f9a5056c99364d8de75
parenta83005077727db3fc927be2f123dc72b33dc5eac (diff)
downloadmplemmings-5b504426f4548ef8a5035284637dae45f9796dec.tar.gz
mplemmings-5b504426f4548ef8a5035284637dae45f9796dec.tar.bz2
mplemmings-5b504426f4548ef8a5035284637dae45f9796dec.zip
scanf de la bonne taille, quelque soit l'archi où on compile
-rw-r--r--reverse-engineering/dosbox_snif/int16todec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/reverse-engineering/dosbox_snif/int16todec.c b/reverse-engineering/dosbox_snif/int16todec.c
index 6499bf6..38348a1 100644
--- a/reverse-engineering/dosbox_snif/int16todec.c
+++ b/reverse-engineering/dosbox_snif/int16todec.c
@@ -1,9 +1,13 @@
#include <stdint.h>
+#include <inttypes.h>
#include <stdio.h>
int main() {
int16_t i;
- scanf("%x", &i);
- printf("0x%04x => %i\n", i, i);
+ if ( scanf("%" SCNx16, &i) == 1 )
+ printf("0x%" PRIx16 " => %" PRId16 "\n", i, i);
+ else
+ printf("Please input some signed 16 bits hex value like 'FFF6'\n");
return 0;
}
+