i'm trying to use stat() to find out a file's size. So far i have :

/* Start Of Code */
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int main (void)
{
        int status;
        struct stat *buf;

        status = stat ("/root/.procmailrc", buf);
        /* don't ask why i'm using my procmailrc, it's the first file */
        /* i thought of */

        return 0;
}
/* End Of Code */

that should have filled buf with info about that file, but how do i go about
displaying the filesize? i know it's in buf->st_size, but that's of type
off_t (what's that?) and printf() segfaults when i try to do

        printf ("File is %d bytes\n", buf->st_size);

well actually i get a warning when compiling.

-- 
[EMAIL PROTECTED]                http://x-map.home.ml.org

Reply via email to