The implementation is as follows:
#include <stdio.h>#include<unistd.h>#include<fcntl.h>#include<sys/stat.h>#include<stdlib.h>#include<time.h>Char* FormatDate (Char*str, time_t val) { //localtime () converts the information in the time_t structure referred to by the parameter TIMEP to the time and date representation used by the real worldStrftime (str, $,"%d.%m.%y%h:%m:%s", LocalTime (&val)); returnstr;}intMain () {structstat Fdstat; Const Char* filename ="Test.txt";//your filename Chardate[ $]; if(Stat (filename, &fdstat) = =-1) {printf ("Open error\n"); Exit (0); } printf ("I-node number:[%d]\n", Fdstat.st_ino); printf ("st_nlink:[%d]\n", Fdstat.st_nlink); printf ("st_uid:[%d]\n", Fdstat.st_uid); printf ("st_gid:[%d]\n", Fdstat.st_gid); printf ("st_blocks:[%d]\n", fdstat.st_blocks); printf ("st_size:[%d]\n", fdstat.st_size); printf ("st_atime:[%d]\n", Fdstat.st_atime); printf ("st_mtime:[%d]\n", Fdstat.st_mtime); printf ("Access:%s\n", FormatDate (date, fdstat.st_atime)); printf ("Modify:%s\n", FormatDate (date, fdstat.st_mtime)); printf ("Change :%s\n", FormatDate (date, fdstat.st_ctime)); return 0;}
Linux stat function