integer to TCHAR array
----------------
TCHAR szStatic[32];
wsprintf(szStatic,_T("%d min(s)"),dwValue);
integer to char array
----------------
char szStatic[32];
sprintf(szStatic,"%d min(s)",dwValue);
CString to char *
----------------
char *szPic=new char[csPic.GetLength()+1] ;
sprintf(szPic,"%S",csPic.GetBuffer(0));
char array to cstring
----------------
char strString[] = "this is a char string";
CString cstring;
cstring = CString( strString );
char array to STL string
---------------------
char buffer[] = "senthil";
string sValue;
sValue.assign((char*)buffer);
LPCSTR to LPCTSTR ( anscii to unicode conversion )
----------------------------------------
LPCSTR psz="senthil";
LPCTSTR m_ptsz=NULL;
const int size = MultiByteToWideChar(CP_ACP, 0, psz, -1, NULL, 0);
if (size == 0) {
ASSERT(!_T("Function \"MultiByteToWideChar\" failed."));
}
m_ptsz = new WCHAR [(sizeof(WCHAR)*size)];
VERIFY(MultiByteToWideChar(CP_ACP, 0, psz, -1, (LPWSTR)m_ptsz, size) != 0);
delete [] m_ptsz;
m_ptsz = NULL;
Friday, May 22, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment