:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
:
int stat(const char *filename, struct stat *buf); -
ctime(time_t *datetime) - time_t string
: st_mtime /* */
student@loony ~/new $ ls -lF
-rwx------ 3 student student 187 2012-12-23 17:20 1.c*
drwxrwxr-x 2 student student 4096 2012-12-23 16:48 p1/
-rwxrwxr-x 1 student student 8623 2012-12-23 20:29 prog*
lrwxrwxrwx 1 student student 2 2012-12-23 17:22 s1 -> p1/
lrwxrwxrwx 1 student student 3 2012-12-23 17:24 s3 -> 1.c*
student@loony ~/new $./prog s1
Sun Dec 23 16:48:43 2012
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{struct stat s;
stat(argv[1], &s);
fprintf(stdout," %s\n",ctime(&s.st_mtime));}
, . .
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
:
int lstat(const char *filename, struct stat *buf); -
ctime(time_t *datetime) - time_t string
: st_mtime /* */
student@loony ~/new $ ls -lF
-rwx------ 3 student student 187 2012-12-23 17:20 1.c*
drwxrwxr-x 2 student student 4096 2012-12-23 16:48 p1/
-rwxrwxr-x 1 student student 8623 2012-12-23 20:29 prog*
lrwxrwxrwx 1 student student 2 2012-12-23 17:22 s1 -> p1/
lrwxrwxrwx 1 student student 3 2012-12-23 17:24 s3 -> 1.c*
student@loony ~/new $./prog s1
Sun Dec 23 17:22:05 2012
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{ struct stat lst;
lstat(argv[1], &lst);
fprintf(stdout," %s\n",ctime(&lst.st_mtime));}
, . .
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
:
int stat(const char *filename, struct stat *buf); -
ctime(time_t *datetime) - time_t string
: st_mtime /* */
student@loony ~/new $ ls -lF
-rwx------ 3 student student 187 2012-12-23 17:20 1.c*
drwxrwxr-x 2 student student 4096 2012-12-23 16:48 p1/
-rwxrwxr-x 1 student student 8623 2012-12-23 20:29 prog*
|
|
lrwxrwxrwx 1 student student 2 2012-12-23 17:22 s1 -> p1/
lrwxrwxrwx 1 student student 3 2012-12-23 17:24 s3 -> 1.c*
student@loony ~/new $./prog s3
Sun Dec 23 17:20:15 2012
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{struct stat s;
stat(argv[1], &s);
fprintf(stdout," %s\n",ctime(&s.st_mtime));}
, . .
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
:
int lstat(const char *filename, struct stat *buf); -
ctime(time_t *datetime) - time_t string
: st_mtime /* */
student@loony ~/new $ ls -lF
-rwx------ 3 student student 187 2012-12-23 17:20 1.c*
drwxrwxr-x 2 student student 4096 2012-12-23 16:48 p1/
-rwxrwxr-x 1 student student 8623 2012-12-23 20:29 prog*
lrwxrwxrwx 1 student student 2 2012-12-23 17:22 s1 -> p1/
lrwxrwxrwx 1 student student 3 2012-12-23 17:24 s3 -> 1.c*
student@loony ~/new $./prog s3
Sun Dec 23 17:24:43 2012
:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{ struct stat lst;
lstat(argv[1], &lst);
fprintf(stdout," %s\n",ctime(&lst.st_mtime));}