#define FNSPACE 30
+#if !defined(_WIN32)
/* Default file permissions 0666 (modulated by umask) */
#define DEFAULT_FILE_PERMISSIONS (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+#else
+#define DEFAULT_FILE_PERMISSIONS (0)
+#endif
/*-*************************************
* Macros
FIO_removeFile(dstFileName);
}
- { const int fd = open(dstFileName, O_WRONLY|O_CREAT|O_TRUNC, mode);
+ {
+#if defined(_WIN32)
+ /* Windows requires opening the file as a "binary" file to avoid
+ * mangling. This macro doesn't exist on unix. */
+ const int openflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
+#else
+ const int openflags = O_WRONLY|O_CREAT|O_TRUNC;
+#endif
+ const int fd = open(dstFileName, openflags, mode);
FILE* f = NULL;
if (fd != -1) {
f = fdopen(fd, "wb");
****************************************/
#if defined(_MSC_VER)
# define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */
+# define _CRT_NONSTDC_NO_WARNINGS /* Disable C4996 complaining about posix function names */
# if (_MSC_VER <= 1800) /* 1800 == Visual Studio 2013 */
# define _CRT_SECURE_NO_DEPRECATE /* VS2005 - must be declared before <io.h> and <windows.h> */
# define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */