Skip to content

FileGetSize

Description

Get size of file without opening it.

Parameters

Name Direction Description
path in Path of file. Prefer Str *; Zstr accepted.

Success

Non-negative value representing size of file in bytes.

Failure

Returns -1 if file cannot be accessed.

Usage example (Cross-references)

Usage examples (Cross-references)
    #    endif
        if (fd < 0) {
            LOG_SYS_ERROR(ErrnoOf(fd), "FileGetSize: open(\"{}\")", filename);
            return -1;
        }
        (void)direct_sys1(MISRA_SYS_close, fd);
        if (sz < 0) {
            LOG_SYS_ERROR(ErrnoOf(sz), "FileGetSize: lseek on \"{}\"", filename);
            return -1;
        }
Last updated on