변환 LPCTSTR 매개 변수 (szNewChr)와 함께 MFC DOC/VIEW 응용 프로그램에서 오류가 발생했습니다. 오류 : C2664 : 'int ATL :: CStringT :: Find (wchar_t, int) throw() const' : 매개 변수 1을 'const char [2]'에서 'wchar_t', 으로 변환 할 수없고 atof 메서드에서 오류가 발생했습니다. 오류 C2664 : 'atof': 'CString'에서 'const char *'로 매개 변수 1을 변환 할 수 없습니다MFC 변환 오류
void CmojaView::UpdateResultsWnd(LPCTSTR szNewChr)
{
// Ensure we are not trying to add a second decimal point!
if(szNewChr == "." && m_strCurrentEntry.Find(".") != -1)
return;
// Update the private member variables
m_strCurrentEntry+=szNewChr;
CString strCurrentEntry(m_strCurrentEntry);
strCurrentEntry.Remove('*');
strCurrentEntry.Remove('/');
m_fResultsWndValue=atof(strCurrentEntry);
m_nClearBtnStatus=0;
}
이 데이터 멤버에 정의되어 있습니다
이 내 방법입니다 .H 파일 :
CString m_strCurrentEntry;
double m_fResultsWndValue;
double m_fRunningTotal;
char m_cLastOp;
int m_nClearBtnStatus;
double m_fMemory;
UINT m_nLastKey;
나는 대화 상자 기반 응용 프로그램 ... 미리 감사로 완벽하게 작동 통지하고 싶습니다.
[this] (http://stackoverflow.com/a/18471079/1889329)를 참조하십시오. 동일한 문제를 해결합니다. – IInspectable