Browse Source

libobs/util: Flush text files when writing

Helps prevent the possibility of an empty file from being written.
jp9000 8 years ago
parent
commit
ac2f792d50
1 changed files with 2 additions and 0 deletions
  1. 2 0
      libobs/util/platform.c

+ 2 - 0
libobs/util/platform.c

@@ -248,6 +248,7 @@ bool os_quick_write_mbs_file(const char *path, const char *str, size_t len)
 	if (mbs_len)
 		fwrite(mbs, 1, mbs_len, f);
 	bfree(mbs);
+	fflush(f);
 	fclose(f);
 
 	return true;
@@ -264,6 +265,7 @@ bool os_quick_write_utf8_file(const char *path, const char *str, size_t len,
 		fwrite("\xEF\xBB\xBF", 1, 3, f);
 	if (len)
 		fwrite(str, 1, len, f);
+	fflush(f);
 	fclose(f);
 
 	return true;