|
안녕하세요~
이제 막 C++에 입문한 회사원입니다.
C++ Builder 를 공부하고 있는중인데요
드라이브에서 특정 파일을 검색해서 그 파일을 지우는 프로그램을 만들고있는데
여기저기서 소스를 붙여넣어서 일단 아래 소스처럼 만들었습니다.
그런데 void __fastcall TForm1::DirRecursiveScan(String path) 메소드를 넣게되면 계속 애러가 나는군요ㅠㅠ
혹시 이 기능을 쓰기위해 따로 선언해야되는것이 있는지 해결방법이 궁금합니다.
혹시 DirRecursiveScan이것말고 제가 임의대로 만들어서 쓸수있는지도 궁금하구요
애러메세지는
'_fastcall TForm1::DirRecursiveScan(UnicodeString)' is not a member of 'TForm1'
Call to undefined function 'DirRecursiveScan'
이렇게 2개가 나옵니다.
기초적인 부분인거 같은데 찾아봐도 개념이 잘 안잡혀서 막히네요 ㅠㅠ
답변 부탁드리겠습니다(__)
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream>
#include <io.h>
#include <string>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
using namespace std;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DirRecursiveScan(String path)
{ //에러부분
String filepath;
TSearchRec sr;
int Found = FindFirst(path+Edit1->Text,faArchive | faDirectory, sr);
While(Found == 0)
{
filepath = path+sr.Name;
if(sr.Name.c_str() != '.')
{
if(DirectoryExists(filepath)) DirRecursiveScan(filepath);
else Memo1->Lines->Add(filepath);
}
Found = FindNext(sr);
}
FindClose(sr);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
DirRecursiveScan("d:\\");
}
//---------------------------------------------------------------------------
|