char* conversion into LPCTSTR
Const Char* dibfilename; int num = MultiByteToWideChar (00, Dibfilename,-10); New Wchar_t[num]; MultiByteToWideChar (00, Dibfilename,-1, wide, num);
Char m_filename[]; // this is possible in multibyte or Unicode mode. _bstr_t bstrtmp (m_filename); = (LPTSTR) bstrtmp;
parsing:
Num Gets the space required for long bytes
MultiByteToWideChar () means that the characters in s are passed to the memory that the PS points to. 1 indicates the transfer to ' + ' in S, Num represents the number of bytes passed.
char* conversion into CString
// char *-->cstring // Outputfilepath = "G:\\testdll" Const Char* Outputfilepath; CString str1 (outputfilepath);
CString conversion into char*
Char*Cdib::cstringtochararray (CString str) {Char*ptr; #ifdef _unicode LONG Len; Len= WideCharToMultiByte (CP_ACP,0, str,-1Null0, NULL, NULL); PTR=New Char[Len +1]; Memset (PTR,0, Len +1); WideCharToMultiByte (CP_ACP,0, str,-1, PTR, Len +1, NULL, NULL);#elseptr=New Char[Str. Getalloclength () +1]; sprintf (PTR, _t ("%s"), str);#endif returnptr;}
VC + + Common data type conversion