共用方式為


CDocument::GetFile

Call this member function to get a pointer to a CFile object.

virtual CFile* GetFile(
   LPCTSTR lpszFileName,
   UINT nOpenFlags,
   CFileException* pError 
);

Parameters

  • lpszFileName
    A string that is the path to the desired file. The path may be relative or absolute.

  • pError
    A pointer to an existing file-exception object that indicates the completion status of the operation.

  • nOpenFlags
    Sharing and access mode. Specifies the action to take when opening the file. You can combine options listed in the CFile constructor CFile::CFile by using the bitwise OR (|) operator. One access permission and one share option are required; the modeCreate and modeNoInherit modes are optional.

Return Value

A pointer to a CFile object.

Requirements

Header: afxwin.h

See Also

Reference

CDocument Class

Hierarchy Chart

CDocTemplate Class

Other Resources

CDocument Members