mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-07-20 04:05:13 -04:00
libobs/util: Flush text files when writing
Helps prevent the possibility of an empty file from being written.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user