i want to convert CString to const char*, i used that const char* cstr = (LPCTSTR)CString; but it doesn't compile,so how to do that, or how to convert CString to double, i used this method _tstof but it returns 0 when i passed a CString to it, so i want to convert CString to const char* inorder to pass the converted value to the method atof(), here's an example:
int nTokenPos=0;
CString leftDigit,rightDigit;
double firstNum,secondNum;
if(dialog->myValue.Find('X')!=-1){
CString resToken = dialog->myValue.Tokenize(_T("X"), nTokenPos);
leftDigit=resToken;
OutputDebugString(leftDigit);
while(!resToken.IsEmpty())
{
resToken = dialog->myValue.Tokenize(_T("X"), nTokenPos);
rightDigit=resToken;
rightDigit+="\n";
//OutputDebugString(rightDigit);
}
firstNum= _tstof(leftDigit);
secondNum=_tstof(rightDigit);
OutputDebugString(leftDigit);
OutputDebugString(rightDigit);
TRACE( "First_Number %d\n",firstNum); --->OutPuts ZERO
TRACE( "\nSecond_Number %d\n",secondNum); --->OutPuts ZERO
//MathFuncs::MyMathFuncs::Multiply(firstNum,secondNum);
TRACE( "The result %d\n",MathFuncs::MyMathFuncs::Multiply(firstNum,secondNum));
0? - Joachim Isaksson