mdelibs/core/file.c

21 lines
388 B
C
Raw Normal View History

2025-11-22 02:29:49 +09:00
#include <MDE/Core/File.h>
2025-11-16 11:24:56 +09:00
2025-11-17 18:20:56 +09:00
void MDEFileCopy(const char* src, const char* dst) {
char buffer[4096];
2025-11-16 11:24:56 +09:00
FILE* in;
FILE* out;
2025-11-17 18:20:56 +09:00
int r;
2025-11-16 11:24:56 +09:00
if((in = fopen(src, "rb")) == NULL) return;
2025-11-17 18:20:56 +09:00
if((out = fopen(dst, "wb")) == NULL) {
2025-11-16 11:24:56 +09:00
fclose(in);
return;
}
2025-11-17 18:20:56 +09:00
do {
2025-11-16 11:24:56 +09:00
r = fread(buffer, 1, sizeof(buffer), in);
fwrite(buffer, 1, r, out);
2025-11-17 18:20:56 +09:00
} while(r == sizeof(buffer));
2025-11-16 11:24:56 +09:00
fclose(in);
fclose(out);
}