|
板凳

楼主 |
发表于 2008-11-17 14:16:03
|
只看该作者
例2:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int ac, char *av[])
{
struct stat info;
if(ac>1)
if( stat(av[1], &info) != -1 ){
show_stat_info( av[1],&info);
return 0;
}
else
perror(av[1]);
return 1;
}
show_stat_info(char *filename, struct stat *buf)
{
printf(" mode: %o\\n", buf->st_mode);
printf(" links: %d\\n", buf->st_nlink);
printf(" usr: %d\\n", buf->st_uid);
printf(" group: %d\\n", buf->st_gid);
printf(" size: %d\\n", buf->st_size);
printf(" modtime: %d\\n", buf->st_mtime);
printf(" name: %s\\n", filename);
} |
|