CString Senserbuf;
int Result(char* str);
long int m_iPulse;
m_iPulse=Result(Senserbuf);
error C2664: 'Result' : cannot convert parameter 1 from 'class CString' to 'char *'
int Result(char* str);
long int m_iPulse;
m_iPulse=Result(Senserbuf);
error C2664: 'Result' : cannot convert parameter 1 from 'class CString' to 'char *'
也就是说CString没有可以转化为char*的运算
如果你需要这种自动转化,可以自己派生一个string类并模仿MFC实现这种转换
int Result(char* str);
long int m_iPulse;
m_iPulse=Result((char*)Senserbuf);
strcpy()等函数实现, 你在函数调用前应做好这个转化
所以,可以转化为LPCTSTR
m_iPulse = Result((char*)(LPCTSTR)Senserbuf);
CString strDes = _T("Hello World");
char *strSrc = new char( strDes.GetLength() );
strcpy( strSrc, strDes );
Result( strSrc );