(Unicode C++) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
#include <CkFileAccessW.h>
void ChilkatSample(void)
{
CkFileAccessW fac;
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
wprintf(L"%s\n",fac.getDirectoryName(L"/MyDir/MySubDir/myfile.ext"));
wprintf(L"%s\n",fac.getDirectoryName(L"/MyDir/MySubDir"));
wprintf(L"%s\n",fac.getDirectoryName(L"/MyDir/"));
wprintf(L"%s\n",fac.getDirectoryName(L"/MyDir"));
wprintf(L"%s\n",fac.getDirectoryName(L"/"));
wprintf(L"%s\n",fac.getExtension(L"C:/mydir.old/myfile.ext"));
wprintf(L"%s\n",fac.getExtension(L"C:/mydir.old/"));
wprintf(L"%s\n",fac.getFileName(L"C:/mydir/myfile.ext"));
wprintf(L"%s\n",fac.getFileName(L"C:/mydir/"));
wprintf(L"%s\n",fac.getFileNameWithoutExtension(L"C:/mydir/myfile.ext"));
wprintf(L"%s\n",fac.getFileNameWithoutExtension(L"C:/mydir/"));
wprintf(L"---\n");
}
|