Caricamento...#include < stdio.h >
#include < sys/types.h >
#include < sys/stat.h >
main(int argc, char **argv)
{
int i;
struct stat buf;
int exists;
for (i = 1; i < argc; i++) {
exists = stat(argv[i], &buf);
if (exists < 0) {
fprintf(stderr, "%s not found\n", argv[i]);
} else {
printf("%10ld %s\n", buf.st_size, argv[i]);
}
}
}
struct stat {
mode_t st_mode; /* mode */
ino_t st_ino; /* i_number */
dev_t st_dev; /* ID del device*/
nlink_t st_nlink; /* numero di hard link */
dev_t st_rdev; /* Ide del device se speciale */
uid_t st_uid; /* user ID */
gid_t st_gid; /* group ID */
off_t st_size; /* dimensione in byte */
time_t st_atime; /* tempo dell?ultimo accesso */
time_t st_mtime; /* tempo ultimo modifica */
time_t st_ctime; /* tempo ultima modifica inode */
long st_blocks; /* numero blocchi allocati */
long st_blksize;/* dimensione dei blocchi in byte */
}
Lascia un commento
Copyright © 2005 - 2010 :: ianaz - created by Silvio Rainoldi