Skip to content

Commit bba7f8d

Browse files
authored
Replace "w" by "wb" when writing binary file
When saving a file in binary format, open the file in binary mode
1 parent d295c96 commit bba7f8d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

main.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,13 @@ static void save_file(unsigned char* data, const char* filename, int filesize, i
408408
{
409409
int i = 0;
410410
int x = 0;
411-
FILE* f = ImFileOpen(filename, "w");
411+
FILE* f;
412+
if (format == FMT_BINARY)
413+
{
414+
f = ImFileOpen(filename, "wb");
415+
} else {
416+
f = ImFileOpen(filename, "w");
417+
}
412418

413419
// Not sure if the compiler takes care of this, but I'll optimize the loop anyway
414420
switch(format)

0 commit comments

Comments
 (0)