我有一个Cstring类型的变量,要计算它的长度,并将应该长度值付值给INT 类型的DLENGTH,再将DLTNEGTH存
入系统所在文件下的ME.TXT中!

解决方案 »

  1.   

    int len = str.GetLength();
      

  2.   

    CString str = _T("hello");;
    int nLenfth = str.GetLength();CString strLength;
    strLength.Format("%d", nLenfth );CStdioFile file("ME.TXT",CFile::modeWrite);
    file.WriteString(strLength);
      

  3.   

    int nlength= str.GetLength();
    CFile file;
    if(file.Open(_T("ME.txt"), CFile::modelWrite))
    {
    file.Write(&nlength, sizoef(int));
    file.Close();
    }
      

  4.   

    seu07201213(【东南】〖汪洋中的一片叶子〗) ( ) 信誉:100  2006-08-13 15:50:00  得分: 0  
     
     
       CString str = _T("hello");;
    int nLenfth = str.GetLength();CString strLength;
    strLength.Format("%d", nLenfth );CStdioFile file("ME.TXT",CFile::modeWrite);
    file.WriteString(strLength);
      
     
    已经说的非常清楚了。不可能再清楚了