我想显示一个时间 但是时间是int型的数字
而messagebox要求的参数是const char *
请问怎样才能正常显示出来呢?

解决方案 »

  1.   

    CTime tm = CTime::GetCurrentTime();CString strTime = tm.Format("y%-m%-d% H%:M%:S%");MessageBox(strTime);
      

  2.   

    CString strTmp;
    int i = 2007;
    strTmp(_T("%d"),i);
    MessageBox(strTmp);
      

  3.   

    我这个时间不是当前的时间 而是自己设定的一个倒计时的时间 所以不能getcurrentime 用回复人:cosobin(cosobin)的方法总是报错:error C2064: term does not evaluate to a function
      

  4.   

    CString strTmp;
    int i = 2007;
    strTmp(_T("%d"),i);
    MessageBox(strTmp);改为CString strTmp;
    int i = 2007;
    strTmp.Format(_T("%d"),i);
    MessageBox(strTmp);
      

  5.   

    struct tm_t
    {
      unsigned short yaer;
      unsigned char month;
      unsigned char day;  //...
    };tm_t tm = {2007, 6, 11};CString strTime;
    strTime.Format("%d-%d-%d", tm.year, tm.month, tm.day);MessageBox(strTime);
      

  6.   

    int Minite=m_time/60;
    int Second=m_time%60;
    CString strTmp;
    strTmp.Format(_T("d%:d%"),Minite,Second);
        MessageBox(strTmp);我这样写对不对啊???