ADDED: GetFileSize()

This commit is contained in:
raysan5 2022-01-27 14:07:05 +01:00
parent 524bf57b74
commit 0f00c41aad
2 changed files with 18 additions and 0 deletions

View file

@ -2851,6 +2851,23 @@ bool DirectoryExists(const char *dirPath)
return result;
}
// Get file size in bytes
int GetFileSize(const char *fileName)
{
int size = 0;
FILE *file = fopen(fileName, "rb");
if (file != NULL)
{
fseek(file, 0L, SEEK_END);
size = (int)ftell(file);
fclose(file);
}
return size;
}
// Get pointer to extension for a filename string (includes the dot: .png)
const char *GetFileExtension(const char *fileName)
{