I still read the C language. I can't use the C language printf function in MFC, so:
Int mfcprintf (const char * m_data ,...)
{
Cstring STR;
Char printf_buf [1024];
Va_list ARGs;
/*
ARGs is a variable defined to point to variable parameters. va_list and the va_start and va_end variables to be used are all defined in
Macros must be used in variable parameter functions, which are defined in the stdarg. h header file.
*/
Int printed;
Va_start (ARGs, m_data); // initialize the ARGs function to point to the first parameter of a Variable Parameter. FMT is the first parameter of a variable parameter.
// A PARAMETER
Printed = vsprintf (printf_buf, m_data, argS );
Va_end (ARGs); // obtain the variable end Parameter
STR = printf_buf;
Int ncount = m_print.getlinecount (); // obtain the number of rows, including the return row
Int nlastline = m_print.lineindex (ncount-1); // obtain the number of characters. Multiple lines are allowed.
M_print.setsel (nlastline + 1, nlastline + 2); // set the area selected by the cursor
M_print.replacesel (STR); // text replacement
Return printed;
}
"Printf" function in MFC