| 
 |  iMatix home page | << | < | > | >>  | 
 
SFLVersion 2.11  | 
#include "sflfile.h"
long
get_file_size (
    const char *filename)
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.
{
    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);
}
| | << | < | > | >> | 
 |