Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2009 11:29
Show Gist options
  • Select an option

  • Save anonymous/163851 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/163851 to your computer and use it in GitHub Desktop.
#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