diff options
Diffstat (limited to 'test/tmpfile.h')
-rw-r--r-- | test/tmpfile.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/tmpfile.h b/test/tmpfile.h index 0f83a20..486cf2e 100644 --- a/test/tmpfile.h +++ b/test/tmpfile.h @@ -17,7 +17,12 @@ public: while(!fp) { filename = tmp_file_template.string() + std::to_string(counter++); + // TODO: Use std::fstream.open() with openmode noreplace when using c++23 +#if defined(_WIN32) + fopen_s(&fp, filename.data(), "wx"); +#else fp = std::fopen(filename.data(), "wx"); +#endif } std::fwrite(data.data(), data.size(), 1, fp); std::fclose(fp); |