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.0141 sec