请教下大虾CStdioFile要包含什么头文件?

解决方案 »

  1.   

    使用MFC框架就不需要添加 什么 头文件了..
      

  2.   

    ls说的没错,如果你实在需要包含的话,参考MSDN:afx.hMFC Library Reference   CStdioFile ClassSee Also
    Class Members | Base Class | Hierarchy Chart | CFile | CFile::Duplicate | CFile::LockRange | CFile::UnlockRange | CNotSupportedException
    Requirements
    Header: afx.hclass CStdioFile : public CFile
    Res
    A CStdioFile object represents a C run-time stream file as opened by the run-time function fopen. Stream files are buffered and can be opened in either text mode (the default) or binary mode.Text mode provides special processing for carriage return–linefeed pairs. When you write a newline character (0x0A) to a text-mode CStdioFile object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0D, 0x0A) is translated to a single 0x0A byte.The CFile functions Duplicate, LockRange, and UnlockRange are not supported for CStdioFile. If you call these functions on a CStdioFile, you will get a CNotSupportedException.For more information on using CStdioFile, see the articles Files in MFC and File Handling in the Run-Time Library Reference.Requirements
    Header: afx.h
      

  3.   

    还是用MFC好,不用加头文件的,
    CStdioFile File;
    NameFile(m_Namenumber);
    CString FileName=m_SavePlace+"//"+strName+".txt";
    if (!File.Open(FileName,CFile::modeWrite|CFile::typeText))
    {
    if (!SetCurrentDirectory(m_SavePlace)) 
    {
                CreateDirectory(m_SavePlace, NULL);
    }
    if(!File.Open(FileName,CFile::modeCreate|CFile::modeWrite|
    CFile::typeText))
    {
    MessageBox(m_SavePlace+strName+".txt"+"不能被创建","信息提示",MB_OK);
    }
    else
    {
    File.SeekToEnd();//先定位到文件尾部 
    File.Write(strData,strData.GetLength()+1);
    File.Close();
    }
    }