Creating and Deleting Directories

Typically a user creates a directory with the Explorer. There are many reasons why you might need to do the same thing inside of an application. For example, if you are writing an application that installs another application or a set of data files, you will need to create directories to hold the files that you are installing. Listing 3.2 uses the CreateDirectory function to create a new directory.

Listing 3.2. Creates the specified directory
void Listing3_2()
{
  TCHAR szPath[MAX_PATH + 1];
  if(!GetTextResponse(_T("Enter Directory to Create:"),
        szPath, MAX_PATH))
     return;
  if(!CreateDirectory(szPath, 0))
     cout ≪ _T("Could not create directory: ")
          ≪ GetLastError();
}
Table 3.2. CreateDirectory—Creates a new directory ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.