From 141bfbdf176d050faa6547e2a21de30f89a98c29 Mon Sep 17 00:00:00 2001 From: MacroModel <33865334+MacroModel@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:50:19 +0800 Subject: [PATCH] fix example --- examples/0036.at/chmod.cc | 7 ++++++- examples/0036.at/chown.cc | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/0036.at/chmod.cc b/examples/0036.at/chmod.cc index f86c46c1..9e67d7a2 100644 --- a/examples/0036.at/chmod.cc +++ b/examples/0036.at/chmod.cc @@ -18,7 +18,12 @@ int main(int argc, char **argv) #endif { ::std::uint_least32_t perm; - ::fast_io::scan(::fast_io::mnp::os_c_str(argv[2]), perm); + auto const [p1, e1] = ::fast_io::parse_by_scan(argv[2], argv[2] + ::fast_io::cstr_len(argv[2]), ::fast_io::mnp::base_get<8>(perm)); + if (e1 != ::fast_io::parse_code::ok) + { + ::fast_io::throw_parse_code(e1); + } + ::fast_io::native_fchmodat(::fast_io::at_fdcwd(), fast_io::mnp::os_c_str(argv[1]), static_cast<::fast_io::perms>(perm)); } #if __cpp_exceptions diff --git a/examples/0036.at/chown.cc b/examples/0036.at/chown.cc index 2a32969a..264d8e78 100644 --- a/examples/0036.at/chown.cc +++ b/examples/0036.at/chown.cc @@ -20,12 +20,12 @@ int main(int argc, char **argv) ::std::uint_least64_t o; ::std::uint_least64_t g; - auto const [p1,e1]= ::fast_io::parse_by_scan(argv[2], argv[2] + ::fast_io::cstr_len(argv[2]), ::fast_io::mnp::base_get<8>(o)); + auto const [p1,e1]= ::fast_io::parse_by_scan(argv[2], argv[2] + ::fast_io::cstr_len(argv[2]), o); if (e1 != ::fast_io::parse_code::ok) { ::fast_io::throw_parse_code(e1); } - auto const [p2, e2] = ::fast_io::parse_by_scan(argv[3], argv[3] + ::fast_io::cstr_len(argv[3]), ::fast_io::mnp::base_get<8>(g)); + auto const [p2, e2] = ::fast_io::parse_by_scan(argv[3], argv[3] + ::fast_io::cstr_len(argv[3]), g); if (e2 != ::fast_io::parse_code::ok) { ::fast_io::throw_parse_code(e2);