Files
anm2ed/src/file.cpp
2025-06-15 22:03:02 -04:00

29 lines
404 B
C++

#include "file.h"
bool
file_read(const char* path, void* buffer, size_t size)
{
SDL_IOStream* ioStream;
memset(buffer, '\0', size);
ioStream = SDL_IOFromFile(path, "r");
if (!ioStream)
{
printf(STRING_ERROR_FILE_READ, path);
return false;
}
if (!SDL_ReadIO(ioStream, buffer, size))
{
printf(STRING_ERROR_FILE_READ, path);
return false;
}
SDL_CloseIO(ioStream);
return true;
}