#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
void main( void )
{
struct stat buf;
int result;
char buffer[] = "A line to output";
result = stat( "stat.c", &buf );
if( result != 0 )
perror( "Problem getting information" );
else
{
printf( "File size : %ld\n", buf.st_size );
printf( "Drive : %c:\n", buf.st_dev + 'A' );
printf( "Time modified : %s", ctime( &buf.st_mtime ) );
}
}
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
void main( void )
{
struct stat buf;
int result;
char buffer[] = "A line to output";
result = stat( "stat.c", &buf );
if( result != 0 )
perror( "Problem getting information" );
else
{
printf( "File size : %ld\n", buf.st_size );
printf( "Drive : %c:\n", buf.st_dev + 'A' );
printf( "Time modified : %s", ctime( &buf.st_mtime ) );
}
}