Programming a PC Card Storage Device

A PC Card storage device is assigned the directory name Storage Card in Windows CE. To create, copy, or delete files on the PC card, open the Storage Card directory. From there you can create, copy, or delete files. A user accesses files on a PC Card storage device by double-tapping on the My Handheld PC icon, which brings up the Windows CE Explorer window. The user then chooses the Storage Card folder.

The following code example shows how to a file named Testfile under \Storagecard\Testdir.

HANDLE   hFile;
DWORD    dwFileLen;
char         szText[]="This is a test file.";

if (CreateDirectory(TEXT("\\Storage Card\\testdir"), NULL))
{
   hFile = CreateFile(TEXT("\\Storage Card\\testdir\\test.txt"),
      GENERIC_WRITE|GENERIC_READ,      //I need read and write access.
      FILE_SHARE_READ,                 //Allow read access for others.
      NULL,                            //Security attributes
      CREATE_ALWAYS,                   //Always create a new file.
      0,                                   //File attribute
      NULL);
   WriteFile(hFile, szText, strlen(szText), &dwFileLen, 0);
   CloseHandle(hFile);
}

Note The actual path for the PC Card storage device is \Storage Card, but due to the special character inside the quotes, you need to assign the path as \\Storage Card.