各位大侠怎么调试VC++/MFC程序的?是用AfxMessageBox吗?有没有象DOS/LINUX下printf的那种东东呢?为什么这样写:
char* m_strTmp = "hello world";
AfxMessageBox(m_strTmp);
出错呢?
可以AfxMessageBox("the string is %s",m_strTmp);的使用吗?自己怎么重新定义?
char* m_strTmp = "hello world";
AfxMessageBox(m_strTmp);
出错呢?
可以AfxMessageBox("the string is %s",m_strTmp);的使用吗?自己怎么重新定义?
这句改为
CString m_strTmp = "hello world";可以AfxMessageBox("the string is %s",m_strTmp);的使用吗?自己怎么重新定义?
不可以这样用。
但可以这样。
CString m_strTmp;
m_strTmp.format("the string is %s", m_strTmp);
void ShowMsg(char *msg, ...)
{
va_list va;
char str[256]; va_start(va,msg);
vsprintf(str,msg,va);
va_end(va); AfxMessageBox(str);
}Example: int a; ShowMsg("The value is %d", a);
调试时一般都是使用trace宏,跟printf使用差不多
就看你的需要了