#define FILE_OUTPUT_MODE O_WRONLY|O_CREAT|O_TRUNC, 0644
#endif
+#if defined(__W32__)
+#define FILE_UPDATE_MODE O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0644
+#elif defined(__MACOS__)
+#define FILE_UPDATE_MODE O_RDWR|O_CREAT|O_TRUNC
+#else /* UNIX */
+#define FILE_UPDATE_MODE O_RDWR|O_CREAT|O_TRUNC, 0644
+#endif
+
extern void set_temporary_encoding(uint32 enc); // called open_output()
extern void reset_temporary_encoding(void); // called close_output()
comment = "(stdout)";
} else {
/* Open the audio file */
- fd = open(fname, FILE_OUTPUT_MODE);
+ fd = open(fname, FILE_UPDATE_MODE);
if(fd < 0) {
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
fname, strerror(errno));
vcedit_state *state = vcedit_new_state();
FILE *ftemp = tmpfile();
- FILE *fin = fdopen(dup(dpm.fd), "wb");
+ FILE *fin = fdopen(dup(dpm.fd), "w+b");
if (!ftemp) {
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "failed to insert loop info; tmpfile() failed");