void CTestView::OnDraw(CDC* pDC) { CTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CString str1, str2; int n=1234567890; str1.Format( "+%d", n ); // +부호 str2.Format( "%d", -n ); // -부호 pDC->TextOut(10,10,str1); pDC->TextOut(10,30,str2); } 출력결과물 …
변수 선언 int num; char str[50]; CString str2; 생성자에서 초기화 num=1234; //sprintf 일때.. sprintf(str,"넘버는 %d 입니다.",num); // str.Format 일때.. CString str2; // str2.Format("번호는 %d 입니다.",num); //출력 pDC->TextOut(100,100,str); pDC->TextOut(100,300,str2);