Discuss this help topic in SecureBlackbox Forum

TElSimpleSFTPClient.OpenFile

TElSimpleSFTPClient     See also     


Filter: C#  VB.NET  Pascal  C++  PHP  Java  


Opens a file on the server.

Declaration

[VB.NET]
    Function OpenFile(ByVal Filename As String, ByVal Modes As TSBSftpFileOpenModes, ByVal Attributes As TElSftpFileAttributes) As Byte()
    Function OpenFile(ByVal Filename As String, ByVal Modes As TSBSftpFileOpenModes, ByVal Access As TSBSftpFileOpenAccess, ByVal Attributes As TElSftpFileAttributes) As Byte()

[Pascal]
    function OpenFile(const Filename : string; Modes : TSBSftpFileOpenModes; Attributes : TElSftpFileAttributes) : TSBSftpFileHandle; overload;
    function OpenFile(const Filename : string; Modes : TSBSftpFileOpenModes; Access : TSBSftpFileOpenAccess; Attributes : TElSftpFileAttributes) : TSBSftpFileHandle; overload;

[C++]
    void OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TElSftpFileAttributes &Attributes, std::vector<uint8_t> &OutResult);
    void OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TElSftpFileAttributes *Attributes, std::vector<uint8_t> &OutResult);
    void OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TSBSftpFileOpenAccess Access, TElSftpFileAttributes &Attributes, std::vector<uint8_t> &OutResult);
    void OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TSBSftpFileOpenAccess Access, TElSftpFileAttributes *Attributes, std::vector<uint8_t> &OutResult);

[PHP]
    string OpenFile(string $Filename, integer $Modes, TElSftpFileAttributes $Attributes)
    string OpenFile(string $Filename, integer $Modes, integer $Access, TElSftpFileAttributes $Attributes)

Parameters

  • Filename - the name of the file to be opened.
  • Modes - specifies the file opening modes.
  • Attributes - specifies the initial attributes for the file.
  • Access - specifies if file must be blocked for reading, writing, or deleting while opened.

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

Return value

    Returns handle to the opened file.

Description

    Use this method to open files on a server side.
    In case of error, EElSFTPError exception containing SFTP error code, is raised. For more information on error handling, please read the corresponding how-to article.

    The file is opened in binary mode, unless fmText flag is included to Modes parameter.

    After you have finished using the directory, close the handle with a call to CloseHandle() method.


    Note, the Access parameter has sense only for SFTPv5 and will be ignored for earlier versions.
    Note, setting of file opening mode differs for VCL and .NET versions. To enable several modes in .NET use bitwise OR operation, for example "fmRead | fmWrite | fmAppend".

See also:     CloseHandle     CreateFile     OpenStream     RemoveFile     Read     Write    

Discuss this help topic in SecureBlackbox Forum