CString to int [MFC project ; UNICODE ]

  • Thread starter Thread starter Bat man 59650
  • Start date Start date
B

Bat man 59650

Guest
hello every one,

i'm triying to convert a CString from an edit box in order to use it as a parameter for a member function (taking an int).

this is the part of the code:

*************************************

int app;
UpdateData(false);
app = atoi((char*)(LPCTSTR)text_zone);
CString msg;
msg.Format(_T("%d"), app);
MessageBox((LPCWSTR)msg); // i used this to show the value ( always getting a 0 )
asc.appel(app); // this is the function needing the int


**************************************



I used _ttoi() ---> doesn't work correctlly (always displaying 0 when i tried to display the value).

I saw some one talking about "atoi(char*)(LPCTSTR)text)" ---> doesn't work correctlly. (always displaying 0 when i tried to display the value).

Continue reading...
 
Back
Top