下の窓の下のフォルダのスキャンファイル

書式#include <io.h>
の#include <stdio.hに>
する#include <iostreamの>
名前空間stdを使用。
INT ReadStationID(CHAR(* ID)[50])
{
構造体_finddata_t C_FILE。
長期のhFile;
char * p = NULL;
int型私= 0;
/ * / *カレントディレクトリ内の最初の.cファイルを探す
((のhFile = _findfirst( "E:\\ KJ_WORKDIR \\ USR \\ callsc_mtv \\ zjcfgmn \\駅\\ * TXT"場合)、&C_FILE)== - 1L)
{
のprintf( "現在のディレクトリにありません* .txtファイル\ nは!");
-1を返します。
}
IF(c_file.name)
のsprintf(ID [I ++]、 "%sの"、はstrtok(c_file.name、) "");
(_findnext(のhFile、&C_FILE)== 0)、一方
{
sprintfの(ID [iが++]、 "%sの"、はstrtok(c_file.name、」。
// printfの( "%sのの\ nを"、c_file.name)。
}
_findclose(のhFile);
0を返します。
}
int型のmain()
{
チャーID [50] [50] = {0}。
ReadStationID(ID)。
以下のために(; iは50 <I ++ iは= 0 INT)
{
COUT << IDを[I] << ENDL。
}
}

おすすめ

転載: www.cnblogs.com/xpylovely/p/11586474.html