C,C++, Get current directory( path ), GetCurrentDirectory function
Get path
#Case 1
char reDir[500]; ::GetCurrentDirectory(500,reDir); ::AfxMessageBox(reDir);
#Case 2
TCHAR buff[MAX_PATH]; memset(buff, 0, MAX_PATH); ::GetCurrentDirectory(MAX_PATH, buff); CString strFolder = buff;
Get path & module nameTCHAR buff[MAX_PATH];
memset(buff, 0, MAX_PATH);
::GetModuleFileName(NULL,buff,sizeof(buff));
CString strFolder = buff;
strFolder = strFolder.Left(strFolder.ReverseFind(_T('\\'))+1);
C, C++, The meaning of LPSTR, LPCSTR, LPTSTR, LPCTSTR, LPWSTR
LP is Long Pointer.
C is constant.
STR is String.
LPSTR = long pointer string = char*
LPCSTR = long pointer constant string = const char*
C is constant.
STR is String.
LPSTR = long pointer string = char*
LPCSTR = long pointer constant string = const char*
W means Wide char and unicode.
LPWSTR = long porinter wide string = w_char*
LPCWSTR = long porinter constant wide string = const w_char*
T is ..
LPCTSTR = long pointer constant t_string = const tchar*
LPWSTR = long porinter wide string = w_char*
LPCWSTR = long porinter constant wide string = const w_char*
T is ..
LPCTSTR = long pointer constant t_string = const tchar*
Subscribe to:
Posts (Atom)
