From f92712b92ccf05a7410f0b7f6fd451cd1f34b5da Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Fri, 28 Jun 2024 16:46:54 +0200 Subject: [PATCH] example2: make strncpy multiplatform --- example2/example2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example2/example2.cpp b/example2/example2.cpp index 7973d965..3a55f528 100644 --- a/example2/example2.cpp +++ b/example2/example2.cpp @@ -86,7 +86,11 @@ int main(int argc, char* argv[]) { if (++i >= argc) return error("Expected output filename!"); +#if defined(_WIN32) strcpy_s(out_filename, sizeof(out_filename), argv[i]); +#else + strncpy(out_filename, argv[i], sizeof(out_filename)); +#endif } else return error("Invalid option: %s\n", argv[i]); }