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

📄 main.cpp

📁 C++ Source code from a tutorial
💻 CPP
字号:
#include <iostream>
#include <stdlib.h>
#include <io.h>
#include <time.h>
#include <string>

using namespace std;

string Chop(string &str) {
    string res = str;
    int len = str.length();
    if (str[len - 1] == '\r') {
        res.replace(len - 1, 1, "");
    }
    len = str.length();
    if (str[len - 1] == '\n') {
        res.replace(len - 1, 1, "");
    }
    return res;
}

void DumpEntry(_finddata_t &data) {
    string createtime(ctime(&data.time_create));
    cout << Chop(createtime) << "\t";
    cout << data.size << "\t";
    if (data.attrib & _A_SUBDIR == _A_SUBDIR) {
        cout << "[" << data.name << "]" << endl;
    }
    else {
        cout << data.name << endl;
    }
}

int main(int argc, char *argv[])
{
    _finddata_t data;
    int ff = _findfirst ("c:/winnt/*.*", &data);
    if (ff != -1) {
        int res = 0;
        while (res != -1) {
            DumpEntry(data);
            res = _findnext(ff, &data);
        }
        _findclose(ff);
    }
    system("PAUSE");
    return 0;
}



⌨️ 快捷键说明

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