DirectoryExists (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example creates a directory, C:\temp, if it does not already exist.

Code

#include <Filectrl.hpp>

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if (!DirectoryExists("c:\\temp"))
  {
	if (!CreateDir("C:\\temp"))
	  throw Exception("Cannot create c:\\temp directory.");
  }
  if (!CreateDir("C:\\temp"))
	throw Exception("Cannot create C:\\temp again!");
}

Uses

Personal tools
Assistance