summaryrefslogtreecommitdiff
path: root/test/tmpfile.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-04-02 21:54:55 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2025-12-23 18:32:57 +0100
commit4d0fa88d4b189d12005f36b076173d01a0d7bb87 (patch)
tree4fae3689d84c5858630be01d806adb6d142a434c /test/tmpfile.h
parenta43e4eeb6a8c1b0906f5af0b964a301d2ec0321b (diff)
Diffstat (limited to 'test/tmpfile.h')
-rw-r--r--test/tmpfile.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/tmpfile.h b/test/tmpfile.h
index 0f83a20..5887e36 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);