CInternetFile* OpenFile( LPCTSTR pstrFileName, DWORD dwAccess = GENERIC_READ, DWORD dwFlags = FTP_TRANSFER_TYPE_BINARY, DWORD dwContext = 1 );
Return Value
A pointer to a CInternetFile object.
Parameters
pstrFileName
A pointer to a string containing the name of the file to be opened.
dwAccess
Determines how the file will be accessed. Can be either GENERIC_READ or GENERIC_WRITE, but not both.
dwFlags
Specifies the conditions under which subsequent transfers occur. This can be any of the following FTP_TRANSFER_* constants:
dwContext
The context identifier for opening the file. See Remarks for more information about dwContext.
Remarks
Call this member function to open a file located on an FTP server for reading or writing. OpenFile should be used in the following situations:
After calling OpenFile and until calling Close, the application can only call CInternetFile::Read, CInternetFile::Write, Close, or CFtpFileFind::FindFile. Calls to other FTP functions for the same FTP session will fail and set the error code to FTP_ETRANSFER_IN_PROGRESS.
The pstrFileName parameter can be either a partially qualified filename relative to the current directory or fully qualified. A backslash (\) or forward slash (/) can be used as the directory separator for either name. OpenFile translates the directory name separators to the appropriate characters before using it.
Override the dwContext default to set the context identifier to a value of your choosing. The context identifier is associated with this specific operation of the CFtpConnection object created by its CInternetSession object. The value is returned to CInternetSession::OnStatusCallback to provide status on the operation with which it is identified. See the article Internet First Steps: WinInet for more information about the context identifier.
CFtpConnection Overview | Class Members | Hierarchy Chart
See Also CInternetConnection, CFtpConnection::GetFile, CGopherConnection::OpenFile, CInternetFile::Write, CInternetFile::Read