how to convert a string to char so that i can get the ASCII value in vc++?
C / C++ / MFC
3
Posts
3
Posters
0
Views
1
Watching
-
if you want to convert a CString, I used the following once in a similar situation. define the next: #if defined (_UNICODE) || defined (UNICODE) #define _tcstombs wcstombs #else #define _tcstombs strncpy #endif //in your code you can then convert CStrings to ascii strings-- CString sOriginalStr; .... //somewhere here sOriginalStr gets a value char* ascStr = new char[sOriginalStr.GetLength()+1]; _tcstombs(ascStr, sOriginalStr, sOriginalStr.GetLength()+1); .. //do your thing with the ascistring delete[] ascStr; Hope this gets you along... Greetz, Davy