CFile file;
file.Write (&strCString, strCString.GetLength() );写进文本文件的是什么玩意?
这个&strCtring怎么转换为LPSTR ?

解决方案 »

  1.   

    写进文本文件的就是变量strCString的地址。
      

  2.   

    strCString.GetBuffer(strCString.GetLength());
    strCString.ReleaseBuffer();
      

  3.   

    Writes (unbuffered) data in a file to the current file position.
    CFile::Write 
    virtual void Write( const void* lpBuf, UINT nCount );
    throw( CFileException );ParameterslpBufA pointer to the user-supplied buffer that contains the data to be written to the file.nCountThe number of bytes to be transferred from the buffer. For text-mode files, carriage return–linefeed pairs are counted as single characters.ResWrites data from a buffer to the file associated with the CFile object. Write throws an exception in response to several conditions, including the disk-full condition.Example//example for CFile::Write
    extern CFile cfile;
    char pbuf[100];
    cfile.Write( pbuf, 100 );
      

  4.   

    写的当然是变量strCString的地址了!!!
      

  5.   

    CFile file;
    file.Write (strCString.GetBuffer(0), strCString.GetLength() );