From 6a2b5acdcf9511bf3b50508910b718e369a028f1 Mon Sep 17 00:00:00 2001 From: Gilles Moris Date: Sun, 19 May 2019 16:10:16 +0200 Subject: [PATCH] Use PRIu64 macro to have a portable way to scan in uint64_t --- support.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support.cc b/support.cc index c80cb2d..03bd1bb 100644 --- a/support.cc +++ b/support.cc @@ -8,7 +8,9 @@ #define __STDC_LIMIT_MACROS #define __STDC_CONSTANT_MACROS +#define __STDC_FORMAT_MACROS +#include #include #include #include @@ -79,7 +81,7 @@ uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & pro cin.getline(line, 255); if (!cin.good()) exit(5); - num = sscanf(line, "%lld", &response); + num = sscanf(line, "%" PRIu64, &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) cout << "Value out of range\n";