File: fstat.c

package info (click to toggle)
tcputils 0.6.2-10
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 244 kB
  • ctags: 134
  • sloc: ansic: 1,277; makefile: 71
file content (29 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>

int
main(int argc, char **argv)
{
    struct stat f;
    int status;

    status = fstat(0, &f);
    printf("Status: %d   errno: %d\n", status, errno);
    printf("st_mode: %o\n", f.st_mode);
    printf("st_ino: %d\n", f.st_ino);
    printf("st_dev: %d\n", f.st_dev);
    printf("st_rdev: %d\n", f.st_rdev);
    printf("st_nlink: %d\n", f.st_nlink);
    printf("st_uid: %d\n", f.st_uid);
    printf("st_gid: %d\n", f.st_gid);
    printf("st_size: %d\n", f.st_size);
    printf("st_atime: %d\n", f.st_atime);
    printf("st_mtime: %d\n", f.st_mtime);
    printf("st_ctime: %d\n", f.st_ctime);
    printf("st_blksize: %d\n", f.st_blksize);
    printf("st_blocks: %d\n", f.st_blocks);

    return 0;
}