/* save current drive. */
curdrive = _getdrive();
printf(\"Available drives in this machine are: n\");
/* if we can switch to the drive, it exists. */
for(drive = 1; drive <= 26; drive++)
if(!_chdrive(drive))
printf(\"%c: \", drive + \'A\' - 1);
printf(\"nnType drive letter to check: \");
chr = _getch();
if(chr == 27)
printf(\"Illegal drive inputn\");
if(isalpha(chr))
_putch(chr);
if(_getdcwd(toupper(chr) - \'A\' + 1, path, _MAX_PATH) != NULL)
printf(\"nCurrent directory on that drive is:n%sn\", path);
/* restore original drive. */
_chdrive(curdrive);
/* get the current working directory */
if(_getcwd(buffer, _MAX_PATH) == NULL)
perror(\"_getcwd error\");
else
printf(\"nCurrent working directory is: %sn\", buffer);
/* create a directory and then delete */
if(_mkdir(newdir) == 0)
{
printf(\"nDirectory %s was successfully createdn\", newdir);
system(\"dir \\testdir\");
if(_rmdir(\"\\testdir\") == 0)
printf(\"nDirectory %s was successfully removedn\", newdir);
else
printf(\"nProblem removing directory %sn\", newdir);
}
else
printf(\"nProblem creating directory %sn\", newdir);