我在显示由一些文本和整数组成的消息时遇到了麻烦

这是我的代码:

int integerNumberOfImportantAppointments = calCalendar.getNumberOfImportantAppointments();

if (integerNumberOfImportantAppointments > 0)
{
    ShowMessage("You have " + integerNumberOfImportantAppointments + " important appointments. Do you wish to view them?");
}

我收到以下错误:E2085无效的指针添加

请问有什么帮助可以使它正常工作吗?

谢谢

最佳答案

试试这个:

int integerNumberOfImportantAppointments = calCalendar.getNumberOfImportantAppointments();
if (integerNumberOfImportantAppointments > 0)
{
   // itoa is not standard (like any of this is)
   WCHAR strN[32];
   swprintf(strN, L"%d", integerNumberOfImportantAppointments);

   // not familiar with ShowMessage(), but I *think* this will work.
   ShowMessage("You have " + UnicodeString(strN) + " important appointments. Do you wish to view them?");
}

关于c++ - ShowMessage具有文本和整数部分,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12558770/

10-11 00:26