Skip to content

Commit 1a0d2ff

Browse files
committed
xrCore/Media/Image: Reimplemented via stdio.
1 parent 3f65531 commit 1a0d2ff

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/xrCore/Media/Image.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "stdafx.h"
22
#include "Image.hpp"
3-
#include <fcntl.h>
4-
#include <sys/stat.h>
5-
#include <io.h>
3+
4+
#include <cstdio>
65

76
using namespace XRay::Media;
87

@@ -18,11 +17,11 @@ Image &Image::Create(u16 width, u16 height, void *data, ImageFormat format)
1817

1918
void Image::SaveTGA(const char *name, ImageFormat format, bool align)
2019
{
21-
int fd = _open(name, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
20+
FILE *file = std::fopen( name, "wb");
2221
auto writerFunc = [&](void *data, u32 dataSize)
23-
{ _write(fd, data, dataSize); };
22+
{ std::fwrite(data, dataSize, 1, file); };
2423
SaveTGA(writerFunc, format, align);
25-
_close(fd);
24+
std::fclose(file);
2625
}
2726

2827
void Image::SaveTGA(IWriter& writer, bool align)

0 commit comments

Comments
 (0)