Đối với các chuỗi TCHAR,char,Wchar là các chuỗi cơ bản trong C,C++,
chúng là những kiểu dữ liệu thuần C ( không phải là class ) vì thế mỗi khi developer sử dụng chúng rất mất thời gian ( do phải nhớ tên từng hàm )
ở đây mình liệt kê một vài hàm đơn giản hay sử dụng để tương tác với chuỗi

wsprintf nối chuỗi
PathIsDirectory Kiểm tra thư mục
PathIsDirectoryEmpty kiểm tra thư mục rỗng
PathIsURL kiểm tra url
PathStripPath lấy tên file
PathIsRoot: lấy đường dẫn root:
PathGetDriveNumber : lấy số thứ tự của ổ đĩa
PathFileExists Kiểm tra file có tồn tại hay không
PathRemoveFileSpec: lấy đường dẫn thư mục nếu truyền FullPath
StrStrI: Tìm kiếm chuỗi con trong chuỗi cha không phân biệt chữ hoa chữ thường #include <Shlwapi.h> #pragma comment(lib,"Shlwapi.lib")


Mã:
#include <windows.h>#include <iostream.h>#include "Shlwapi.h" void main( void ){    // String path name 1.    char buffer_1[ ] = "C:\\";    char *lpStr1;    lpStr1 = buffer_1;     // String path name 2.    char buffer_2[ ] = "path\\file";    char *lpStr2;    lpStr2 = buffer_2;     // Variable to get the return from "PathIsRoot".    int retval;     // Test case with path not absolute.    retval = PathIsRoot(lpStr1);    cout << "The return from function is       :" << retval << endl;    cout << "The path does contain a root part :" << lpStr1 << endl;     // Test case with path absolute.    retval = PathIsRoot(lpStr2);    cout << "The return from function is       :" << retval << endl;    cout << "The path does not contain part    :" << lpStr2 << endl;}
Mã:
The return from function is:       1The path does contain a root part:                  C:\The return from function is:                            0The path does not contain part:                      path\file
tìm tên file không có đuôi mở rộng


Mã:
bool PathFindFileNotExtend(__in TCHAR* tszFileIn,__out TCHAR* tszFileNameNotExtend){    TCHAR tszFileTemp[MAX_FOLDER_PATH];    lstrcpy(tszFileTemp, PathFindFileName(tszFileIn));    if (tszFileTemp == NULL)    {        tszFileNameNotExtend = NULL;        return false;    }    int ileng = lstrlen(tszFileTemp);    int i;    for (i = ileng - 1;i>= 0;i--)    {        if (tszFileTemp[i] == _T('.') )        {            tszFileTemp[i] = _T('\0');            break;        }    }    if (i == 0)    {        tszFileNameNotExtend = NULL;        return false;    }    lstrcpy(tszFileNameNotExtend, tszFileTemp);    return true;}
lấy đường dẫn thư mục nếu tham số truyền vào là fullPath

Mã:
/* Get Path Folder */bool GetFolderPath_FromFullPath(__in TCHAR* tszPathIn,__out TCHAR* tszDirectory){    lstrcpy(tszDirectory,tszPathIn);    int ileng = lstrlen(tszDirectory);    int i;    for ( i = ileng -1;i>=0;i--)    {        if (tszDirectory[i] == _T('\\'))        {            tszDirectory[i] = _T('\0');            break;        }    }    if (i == 0)    {        tszDirectory = NULL;        return false;    }    return true; }
Mã:
int _stricmp(   const char *string1,   const char *string2 );int _wcsicmp(   const wchar_t *string1,   const wchar_t *string2 );int _mbsicmp(   const unsigned char *string1,   const unsigned char *string2 );int _stricmp_l(   const char *string1,   const char *string2,   _locale_t locale);int _wcsicmp_l(   const wchar_t *string1,   const wchar_t *string2,   _locale_t locale);int _mbsicmp_l(   const unsigned char *string1,   const unsigned char *string2,   _locale_t locale);
msdn.microsoft.com/en-us/library/k59z8dwe%28v=VS.80%29.aspx
những hàm hay sử dụng đã được liệt kê ở trên, Ngoài ra còn rất nhiều hàm,xem thêm tại đây
devdaily.com/scw/c/cygwin/src/winsup/w32api/include/shlwapi.h.shtml