Linux下获取文件大小,检索目录函数
来源:互联网 发布:真维斯官方旗舰店淘宝 编辑:程序博客网 时间:2024/06/05 06:36
#include <stdio.h>#include <stdlib.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>#include <dirent.h>#include <string>#include <iostream>#define PATH "/media/work/test"int main(int argc, char **argv){ DIR *pDir = opendir(PATH); if (pDir == NULL) { perror("opendir failed.\n"); } struct dirent *pDirent; std::string picture("test.cpp"); std::string str; while((pDirent = readdir(pDir)) != NULL) { //printf("name: %s\n", pDirent->d_name); str = pDirent->d_name; if (str.find(picture) != str.npos) { std::cout<<"string name: "<<str<<std::endl; break; } } struct stat buf; if (stat(str.c_str(), &buf) == -1) { perror("stat failed.\n"); } std::cout<< "size: "<<buf.st_size<<std::endl; std::cout<< "st_mtime: "<<ctime(&buf.st_mtime)<<std::endl; return 0;}
0 0
- Linux下获取文件大小,检索目录函数
- Linux下获取文件大小,检索目录函数
- linux获取目录下文件大小的问题
- linux下获取文件大小
- Linux:查看目录下文件大小
- Linux 获取文件大小--C函数
- Linux 获取文件大小--C函数
- linux获取文件大小的函数
- Linux 获取文件大小--C函数
- linux下获取文件大小总结
- linux c 下获取文件大小
- linux c 下获取文件大小
- linux c下获取文件大小
- linux 使用lseek函数来获取文件大小
- Linux下获取文件大小的方法
- Linux下获取文件大小的方法
- Linux下获取文件大小的方法
- Linux下获取文件大小的方法
- 《Java并发编程实战》读书笔记·Part2
- URL地址中的中文乱码问题的解决
- HaloDao之前后台全自动动态多条件查询组件实现(一)
- linux free命令中buffer与cache的区别
- 图片透明度。。SeekBar
- Linux下获取文件大小,检索目录函数
- linux coding
- <Essential C++> Learning
- 多线程同步(C++)event
- 重构验收总结(一)
- UVA - 11987 - Almost Union-Find (又是并查集~)
- nyoj-102-次方求模
- 【ACM】----杭电oj 2097
- 【Python学习】电子书