| #include <assert.h> |
| #include <direct.h> |
| #include <stdio.h> |
| |
| /* mingw-w64 headers */ |
| #include "libtest.h" |
| |
| int main() { |
| FILE *file; |
| |
| mingw_test_init (); |
| |
| /* 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; |
| } |