title: How to convert CString to const char*?
body: <p>i want to convert CString to const char*, i used that <code>const char* cstr = (LPCTSTR)CString;</code> 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:</p>
  
  <pre><code>int nTokenPos=0;
  CString leftDigit,rightDigit;
  double firstNum,secondNum;
  
  if(dialog-&gt;myValue.Find('X')!=-1){
  CString resToken = dialog-&gt;myValue.Tokenize(_T("X"), nTokenPos);
  leftDigit=resToken;
  OutputDebugString(leftDigit);
  while(!resToken.IsEmpty())
  {
     resToken = dialog-&gt;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); ---&gt;OutPuts ZERO
   TRACE( "\nSecond_Number %d\n",secondNum); ---&gt;OutPuts ZERO
  //MathFuncs::MyMathFuncs::Multiply(firstNum,secondNum);
   TRACE( "The result %d\n",MathFuncs::MyMathFuncs::Multiply(firstNum,secondNum));
  </code></pre>