windows下遍历文件夹下的文件
#include <io.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int ReadStationID(char(*id)[50])
{
struct _finddata_t c_file;
long hFile;
char *p = NULL;
int i = 0;
/* Find first .c file in current directory */
if ((hFile = _findfirst("E:\\KJ_WORKDIR\\usr\\callsc_mtv\\zjcfgmn\\Station\\*.txt", &c_file)) == -1L)
{
printf("No *.txt files in current directory!\n");
return -1;
}
if (c_file.name)
sprintf(id[i++], "%s", strtok(c_file.name, "."));
while (_findnext(hFile, &c_file) == 0)
{
sprintf(id[i++], "%s", strtok(c_file.name, "."));
//printf(" %s\n", c_file.name);
}
_findclose(hFile);
return 0;
}
int main()
{
char id[50][50] = {0};
ReadStationID(id);
for(int i = 0; i< 50; i++)
{
cout << id[i] << endl;
}
}
最新文章
- Ubuntu 网络参数设置
- 掌握Thinkphp3.2.0----标签库
- 学习Jquery
- nginx源码分析—内存池结构ngx_pool_t及内存管理
- minhash
- web.xml filter 顺序
- awk 传入外部参数
- 在[self addsubView:xxx]中,self.name 和 _name的区别
- tomcat的webappclassloader中一个奇怪的异常信息
- js表白心形特效
- 安装mq的时候,计算机用户名是中文名的解决办法
- Values &; Reference:值和引用
- MATLAB 移动复制文件
- cgi,fast-cgi,php-cgi,php-fpm转载详解
- thinkphp生成的验证码提示因存在错误无法显示
- tms web core程序部署
- 【代码笔记】iOS-iphone开发之获取系统字体
- 【硬件】- 英特尔CPU命名规则
- emacs 中使用git diff命令行
- mybatis分享