| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

get_file_size

#include "sflfile.h"
long
get_file_size (
    const char *filename)

Synopsis

Returns the size, in bytes, of the specified file or directory. The size of a directory is not a portable concept. If there is an error, returns -1.

Source Code - (sflfile.c)

{
    struct stat
        stat_buf;

    ASSERT (filename);

#   if (defined (MSDOS_FILESYSTEM))
    if (system_devicename (filename))
        return (-1);                    /*  Not allowed on device names      */
#   endif
    if (stat ((char *) filename, &stat_buf) == 0)
        return ((long) stat_buf.st_size);
    else
        return (-1);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation