blob: 58515d4323473d1415aab9ec6ad559815dab721f [file] [log] [blame]
#include <stdio.h>
#include <direct.h>
#include <assert.h>
int main() {
FILE *file;
/* ensure that tmpfile() works also when cwd is in C:\Windows or C:\ but do not fail if caller has no access to C:\ */
if (chdir("C:\\Windows\\") != 0)
chdir("C:\\");
file = tmpfile();
assert(file);
assert(fputs("test", file) >= 0);
assert(fflush(file) == 0);
/* ensure that _rmtmp() works also for emulated mingw-w64 tmpfile() implementation */
assert(_rmtmp() == 1);
return 0;
}