1 | #include <stdio.h>
|
---|
2 | #include <sys/stat.h>
|
---|
3 | #include <unistd.h>
|
---|
4 |
|
---|
5 | int main ()
|
---|
6 | {
|
---|
7 | FILE *fp;
|
---|
8 | char buf[10];
|
---|
9 | struct stat st;
|
---|
10 |
|
---|
11 | fp = fopen ("foo.c", "r");
|
---|
12 | fread (buf, 1, sizeof (buf), fp);
|
---|
13 | fclose (fp);
|
---|
14 | sleep (1);
|
---|
15 | if (stat ("foo.c", &st) >= 0)
|
---|
16 | printf ("atime = %ld\n", (long) st.st_atime);
|
---|
17 | sleep (1);
|
---|
18 | if (stat ("foo.c", &st) >= 0)
|
---|
19 | printf ("atime = %ld\n", (long) st.st_atime);
|
---|
20 | sleep (1);
|
---|
21 | if (stat ("foo.c", &st) >= 0)
|
---|
22 | printf ("atime = %ld\n", (long) st.st_atime);
|
---|
23 | }
|
---|