SysGetFileSize

Table of Contents

SysGetFileSize

Description

Get size of file without opening it.

Parameters

NameDirectionDescription
filenameinName/path of file.

Success

Non-negative value representing size of file in bytes.

Failure

Returns -1 if file cannot be accessed.

Usage example (Cross-references)

    
    // get actual size of file
    i64 fsize = SysGetFileSize(filename);
    if (-1 == fsize) {
    LOG_ERROR("failed to get file size");
    
    // Cross-platform function to get file size
    i64 SysGetFileSize(const char *filename) {
    #ifdef _WIN32
    // Windows-specific code using GetFileSizeEx

Share :

Related Posts

FWriteFmt

FWriteFmt Description Write formatted output to a file stream. This macro internally uses StrWriteFmtInternal to format the string and then writes it to the stream.

Read More

FReadFmt

FReadFmt Description Read formatted data from a file stream. This is a macro wrapper around FReadFmtInternal.

Read More

LogDeinit

LogDeinit Description Shut down logging subsystem and release resources

Read More