CString str,ab=_T("abc");
str.Format(_T("%d",ab.GetLength()));
MessageBox(str);得到的长度居然是个负数,为什么啊?编译环境为VS2008。

解决方案 »

  1.   

    str.Format(_T("%d",ab.GetLength()));str.Format(_T("%d"),ab.GetLength());
      

  2.   

    str.Format(_T("%d"),ab.GetLength());不要重复发帖嘛
      

  3.   

    str.Format(_T("%d"),ab.GetLength());
      

  4.   

    不行就这样..
    int strLen = ab.GetLength();
    str.Format(_T("%d"),strLen);再要是负数就没辙...
      

  5.   

    汗, 细心啊CString str,ab=_T("abc");
    str.Format(_T("%d",ab.GetLength()));
    MessageBox(str);
    你的格式化字符的那个右括号位置不对。