Skip to content

Commit

Permalink
example2: make strncpy multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Jun 28, 2024
1 parent ad955ca commit f92712b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example2/example2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down

0 comments on commit f92712b

Please sign in to comment.