The problem appears to be that tmpfile() is implemented by msvcrt, which is unmaintained by Microsoft. tmpfile() in msvcrt is broken by design because it tries to create the temporary file in C:\ which is not writable by non-administrators. This is documented: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/tmpfile?view=msvc-170 The best workaround today appears to be the usage of mkstemp() which requires much more code: you need to create a pattern string in a writable buffer,...