|
안녕하세요..
제가 묻고 싶은것은..
sr.Name 에 관한것인데...
리스트.txt 라는 파일이 있는데..이곳에는 파일 이름이 저장되어있습니다..
이곳에 있는 파일이름을 하나씩 읽어서 특정디렉토리에 있는지 없는지를 검색하는 프로그램을 만들려고 합니다.
가장 어려운 부분은 sr.Name 와 파일 이름을 비교 하는것인데...
만약에..리스트.txt 에...
1.txt
2.txt
3.txt
라고 저장되어있다고 가정하고..
c:\ex 디렉토리에 이들 파일이 있는지 찾는 프로그램인데...
sr.Name가 계속 1.txt만 지시해서 이것을 어떻게..다음으로 넘기는지 모르겠습니다..
그럼 제가짠 소스를 올려드리지요..
void __fastcall TForm1::DirRecursiveScan(String path)
{
//TODO: Add your source code here
int CountEnd;
Memo1->Lines->LoadFromFile("c:\\연습\\리스트.lst");
CountEnd=Memo1->Lines->Count;
try
{
if(String(path.AnsiLastChar()) != "\\") path += "\\";
AnsiString fpath, SaveEn, currpath, Filename, temp;
TSearchRec sr;
char *pszBuffer;
int inFile;
int iFileLen;
int Found = FindFirst(path + "*.*", faArchive | faDirectory, sr);
while(Found == 0)
{
fpath = path + sr.Name;
if(*sr.Name.c_str() != '.')
{
if(DirectoryExists(fpath)) DirRecursiveScan(fpath);
else
{
for(int i=0;i<CountEnd;i++)
{
if(sr.Name==Memo1->Lines->Strings[i]) <-----
Memo2->Lines->Strings[i]=sr.Name; <----- 에서 계속 ..sr.Name 가 다음 파일명으로 넘어 가지 않네요
else
Memo2->Lines->Strings[0]=sr.Name;
}
}
}
Found = FindNext(sr);
}
FindClose(sr);
}
catch(Exception *e)
{
throw e;
}
}
그럼 수고하세요
|