///////////////////////////////////////////////////////////////////////////// // Creation 11/12/2003 // // // STAT.C // ------ // // // Sylvain MARECHAL - sylvain.marechal1@libertysurf.fr ///////////////////////////////////////////////////////////////////////////// // // Exemple d'utilisation de stat() // -Cree un fichier fopen.txt au premier lancement // -Lit le fichier fopen.txt au 2° lancement // // ///////////////////////////////////////////////////////////////////////////// #include #include #include #include void main( void ) { struct stat buf; int result; char buffer[] = "A line to output"; // infos sur stat.c result = stat( "stat.c", &buf ); if( result != 0 ) { printf( "Problem getting information" ); } else { // Soit printf( "File size : %ld\n", buf.st_size ); printf( "Drive : %c:\n", buf.st_dev + 'A' ); printf( "Time modified : %s", ctime( &buf.st_atime ) ); } }