E D R , A S I H C RSS

Cpp에서의가변인자

란?

C io 브러리 printf . 는 MFC - CString CString::Format CString::AppendFormat . ... . 를 받 .

만들

~cpp 
void Foo(LPCTSTR pFmt, ...)
{
	int		len;
	va_list		args;
	TCHAR		*pbuf;
	CString		str;

	va_start(args, pFmt);
	len  = _vsctprintf(pFmt, args) + 1;
	pbuf = new TCHAR[len];
	_vstprintf(pbuf, pFmt, args);

	AfxMessageBox(str);

	SAFEDELETE(pbuf);
}
. 뭐는.. MSDN . 몰 .

AfxMessageBox . 를 몰랐
~cpp 
CString str;
str.Format(_T("a : %d, b : %d, c: %d"), a, b, c);
AfxMessageBox(str);
만,
.
~cpp 
VAMessageBox(_T("a : %d, b : %d, c: %d"), a, b, c);	// variant argument(?) . 

런 메 몰랐는데~ -
.--; 냥 만; --


Java 1.5 . printf .; --1002

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:02
Processing time 0.0112 sec