7 fmemopen(void *buf, size_t size, const char *mode)
9 char temppath[MAX_PATH + 1];
10 char tempnam[MAX_PATH + 1];
15 if (strcmp(mode, "r") != 0 && strcmp(mode, "r+") != 0)
17 l = GetTempPath(MAX_PATH, temppath);
18 if (!l || l >= MAX_PATH)
20 if (!GetTempFileName(temppath, "solvtmp", 0, tempnam))
22 fh = CreateFile(tempnam, DELETE | GENERIC_READ | GENERIC_WRITE, 0,
24 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE,
26 if (fh == INVALID_HANDLE_VALUE)
28 fp = _fdopen(_open_osfhandle((intptr_t)fh, 0), "w+b");
34 if (buf && size && fwrite(buf, size, 1, fp) != 1)