hello..
may i know how to change type from CString to long??
eg., CString------> "123"
to
long --------> 123
is it possible?
pls... help.. sos..
Printable View
hello..
may i know how to change type from CString to long??
eg., CString------> "123"
to
long --------> 123
is it possible?
pls... help.. sos..
Use the atol function:
CString str = "123";
long val;
val = atoi(str);
// val = 123
Hope it helps
HD
thanks..
:)
I don't think atoi() takes a CString object as its parameter.Quote:
Originally posted by HairyDave
Use the atol function:
CString str = "123";
long val;
val = atoi(str);
// val = 123
Hope it helps
HD
Hazel can try
int val=atoi((LPCTSTR)str);
Hope it helps.;)
CString is automatically converted to LPCTSTR so it works without the explicit cast.
hey thank you all guyz!
but "atol" doesn't work or there's something wrong wih my program, i cant get the value...
ok..anyway..thanks..
i'll try again..
hi..
i put some update statements and now my program can work..
thanks for the help..
:)