헤더에 #include <FileCtrl.hpp>추가 해야 됩니다.
//---------------------------------------------------------------------------
// Create Directory
//
//
void __fastcall TForm1::MakeDirectory(AnsiString strPath)
{
TStringList *strlstDir = new TStringList;
try
{
strlstDir->Text = StringReplace(strPath, "\\", "\r\n",
TReplaceFlags()<< rfReplaceAll << rfIgnoreCase);
strPath = strlstDir->Strings[0] + "\\";
for(int i=1; i<strlstDir->Count; i++)
{
strPath += strlstDir->Strings[i] + "\\";
if (!DirectoryExists(strPath))
{
if (!CreateDir(strPath))
throw Exception("폴더를 생성할수 없습니다");
}
}
}
__finally
{
delete strlstDir;
}
}
|