Created
August 7, 2009 11:29
-
-
Save anonymous/163851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <windows.h> | |
| main() | |
| { | |
| char meat[100000],result[100000]; //meat[] 儲存讀入檔案的字元 | |
| int i,r=1,t;//result[] 存入符合條件的字串 條件部分還沒寫到 | |
| FILE *fp; //開啟檔案指標 | |
| WIN32_FIND_DATA wfd; | |
| HANDLE hFind; | |
| hFind = FindFirstFile("*.txt", &wfd); | |
| if (hFind != INVALID_HANDLE_VALUE)/* 檔名儲存於 wfd.cFileName, 對其開檔做讀取處理 */ | |
| { | |
| do | |
| { | |
| fp = fopen(wfd.cFileName,"rt"); | |
| i=1; | |
| do//i | |
| { | |
| fscanf(fp,"%c",&meat[i]); | |
| result[r] = meat[i]; | |
| i++; | |
| r++; | |
| }while(meat[i] != '\0' ); | |
| fclose(fp); | |
| }while (FindNextFile(hFind, &wfd)); | |
| } | |
| FindClose(hFind); | |
| i=1; | |
| do//i | |
| { | |
| printf("%c",result[i]); | |
| i++; | |
| }while(result[i]!='\0'); | |
| system("pause"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment