Commit e1c11ec2 authored by Son Pham's avatar Son Pham

Activity16 completed

parent 3506ecd6
* Name: Son Pham
* Class: CSCI 315
* Prof: Luiz Felipe Perrone
* Activity 16
#include <stdio.h>
#include <unistd.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
int main(int argc, char *argv[]) {
// Accept the first argument as file name
char *name = argv[1];
struct statvfs stats;
// Read the file stats into statvfs
statvfs(name, &stats);
// Print out necessary information
printf("File System\n");
printf("Block size: %d\n", stats.f_bsize);
printf("Max filename length: %d\n", stats.f_namemax);
// Status
struct stat status;
stat(name, &status);
printf("File stats\n");
printf("File size: %d\n", status.st_size);
printf("User ID: %d\n", status.st_uid);
printf("Last Modified: %s\n", ctime(&status.st_mtime));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment