MFC변수 설정에 대한 질문
조회수 569회
MFC EditControl에서 숫자를 입력하고, button 클릭 시 입력받은 숫자로 .bat 파일을 생성하려고 합니다.
void CmfctonodejsDlg::OnBnClickedOk()
{
CString strText = _T("");
m_Devid.GetWindowText(strText);
CString strText2, strText3;
strText2 = "sample ";
strText3 = strText2 + strText;
ofstream batch;
batch.open("C:/Users/sample.bat",ios::out);
batch << strText3;
batch.close();
system("C:/Users/sample.bat");
}
위 코드중 CString strText... 부터 strText3 = strText2 + strText; 까지를 밖으로 빼내서 다른 버튼에서도 사용하게 하고 싶은데
CString strText = _T("");
m_Devid.GetWindowText(strText);
CString strText2, strText3;
strText2 = "sample ";
strText3 = strText2 + strText
이 선언에는 스토리지 클래스 또는 형식 지정자가 없습니다. 라는 오류와함께 실행이 안됩니다. void CmfctonodejsDlg::OnBnClickedOk()밖에서 strText, strText2, strText3를 지정해주고 여러 버튼에서 쓸수는 없나요?
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력