⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p3-159.cpp

📁 欢迎使用,大家要努力学习! 开开心心编程! 原大家都成为高手中的高手!
💻 CPP
字号:
#include<iostream.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

void main( void )
{
    struct stat buf;
    int result;

    //获得c:\Windows\Calc.exe文件的状态信息
    result =stat( "c:\\windows\\Calc.exe", &buf );

    //显示Calc.exe文件的状态信息
   if( result != 0 )
       perror( "Problem getting information" );
    else
    {
        cout<<"Size of the file in bytes:"<<buf.st_size<<endl;
        cout<<"Drive number of the disk containing the file :";
        cout<<char(buf.st_dev + 'A')<<endl;
        cout<<"Time of creation of the file:"<<ctime(&buf.st_ctime);
        cout<<"Time of last access of the file:"<<ctime(&buf.st_atime);
        cout<<"Time of last modification of the file:"<<ctime(&buf.st_mtime);
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -