advent2024

Advent of Code 2024
git clone git://bsandro.tech/advent2024
Log | Files | Refs

commit 150922748aeb440466166f95b73eccaef62a123c
parent c27078ad75197699b6447298be154acf53b07bdf
Author: bsandro <email@bsandro.tech>
Date:   Fri,  3 Jan 2025 00:47:09 +0200

PRIi64 to SCNi64 for sscanf()

Diffstat:
Mday13/main.cpp | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/day13/main.cpp b/day13/main.cpp @@ -15,7 +15,7 @@ struct Vec2 { int64_t y; void fromStr(const std::string &s) { [[ maybe_unused ]] char btn; - std::sscanf(s.c_str(), "Button %c: X+%" PRIi64 ", Y+%" PRIi64, &btn, &x, &y); + std::sscanf(s.c_str(), "Button %c: X+%" SCNi64 ", Y+%" SCNi64, &btn, &x, &y); } bool operator==(const Vec2 &other) const { return this->x==other.x && this->y==other.y; @@ -30,7 +30,7 @@ struct Machine { Vec2 btnB; Vec2 prize; void setPrize(const std::string &s) { - std::sscanf(s.c_str(), "Prize: X=%" PRIi64 ", Y=%" PRIi64, &prize.x, &prize.y); + std::sscanf(s.c_str(), "Prize: X=%" SCNi64 ", Y=%" SCNi64, &prize.x, &prize.y); } };