char mychar;
CString myCString,myLetter;
myCString=_T("From this I want 1st Character");
myLetter=myCString.Mid(0,1);//Now myLetter="F"
TCHAR* pmyLetter;
pmyLetter=myLetter.GetBuffer();
myLetter.ReleaseBuffer();
TCHAR pszmyLetter[1];
_stprintf(pszmyLetter,_T("%s"),pmyLetter);
mychar=pszmyLetter[0];//Now sucessfully mychar='F'
Like wise you can do for character array char[] also from CString I know this is not professional but going through all conversions i failed to acheieve sucessful conversion in Visual Studio 2013 so this method works for me fine with out any debug errors or assertion warnings.
Hope this will help you :-)
CString myCString,myLetter;
myCString=_T("From this I want 1st Character");
myLetter=myCString.Mid(0,1);//Now myLetter="F"
TCHAR* pmyLetter;
pmyLetter=myLetter.GetBuffer();
myLetter.ReleaseBuffer();
TCHAR pszmyLetter[1];
_stprintf(pszmyLetter,_T("%s"),pmyLetter);
mychar=pszmyLetter[0];//Now sucessfully mychar='F'
Like wise you can do for character array char[] also from CString I know this is not professional but going through all conversions i failed to acheieve sucessful conversion in Visual Studio 2013 so this method works for me fine with out any debug errors or assertion warnings.
Hope this will help you :-)
No comments:
Post a Comment