#include <windows.h>
#include <tchar.h>
int main(int argc, char *argv[]){
WIN32_FIND_DATA FileData;
BOOL fFinished;
HANDLE hList;
FILE *stream;
hList = FindFirstFile("*", &FileData);
if (hList == INVALID_HANDLE_VALUE){
printf("No files under this direction");
}
BOOL fFinished;
HANDLE hList;
FILE *stream;
hList = FindFirstFile("*", &FileData);
if (hList == INVALID_HANDLE_VALUE){
printf("No files under this direction");
}
else{
fFinished = FALSE;
while (!fFinished){
if ( strstr(FileData.cFileName,".txt") ){ //判斷副檔名是不是 .txt
stream = fopen(FileData.cFileName,"r"); //fopen( const char * filename, const char * mode );
if(stream==NULL){
//return;
}
else{ //讀檔
}
fclose(stream);
}//if 判斷副檔名是不是 .txt
fFinished = FALSE;
while (!fFinished){
if ( strstr(FileData.cFileName,".txt") ){ //判斷副檔名是不是 .txt
stream = fopen(FileData.cFileName,"r"); //fopen( const char * filename, const char * mode );
if(stream==NULL){
//return;
}
else{ //讀檔
}
fclose(stream);
}//if 判斷副檔名是不是 .txt
//--------------計算-------------//
if (!FindNextFile(hList, &FileData)){
if (GetLastError() == ERROR_NO_MORE_FILES){
fFinished = TRUE;
}
}
}//while
}
if (GetLastError() == ERROR_NO_MORE_FILES){
fFinished = TRUE;
}
}
}//while
}
FindClose(hList);
system("PAUSE");
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
全站熱搜
留言列表