加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows下遍历文件夹下的文件

发布时间:2020-12-14 05:57:26 所属栏目:Windows 来源:网络整理
导读:#include io.h#include stdio.h#include iostreamusing 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:

#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_WORKDIRusrcallsc_mtvzjcfgmnStation*.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++],".")); //printf(" %sn",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; }}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读