扫描目录文件

来源:互联网 发布:永久中立国的意义 知乎 编辑:程序博客网 时间:2024/06/07 05:04

这几天在将win32下的游戏移植到android平台时,需要输入很多cpp文件,手动拷贝很慢也容易出错,别人给的扫描程序是java写的,不想用,于是就自己实现了一个。花了较多时间,关键是unix接口不太熟悉或者根本不知道有这个东西,开始还想着自己完全自己实现,.2....无知者无畏啊!于是把unix环境高级编程拿来翻了翻,搞定了。有空把源码传到GitHub上去。

API:sys/stat.h:int stat(const char *restrictpathname,struct stat *restrict buf);int fstat(int fields,struct stat *buf);int lstat(const char *restrictpathname,struct stat *restrict buf);dirent.h:static DIR *opendir (const char *dirname);static struct dirent *readdir (DIR *dirp); 返回参数dir 目录流的下个目录进入点,否则返回NULL;static int closedir (DIR *dirp);



0 0