System.IOUtils.TFile.Open

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function Open(const Path: string;
const Mode: TFileMode): TFileStream; overload; inline; static;
class function Open(const Path: string;
const Mode: TFileMode; const Access: TFileAccess): TFileStream;
class function Open(const Path: string;
const Mode: TFileMode; const Access: TFileAccess;
const Share: TFileShare): TFileStream; overload; static;

C++

static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode)/* overload */;
static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode, const TFileAccess Access)/* overload */;
static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode, const TFileAccess Access, const TFileShare Share)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.IOUtils.pas
System.IOUtils.hpp
System.IOUtils TFile

Description

Opens a file and returns a stream associated with that file.

Call Open to open a file. Depending on the TFileMode value passed, the file is opened, created, or appended. Any way, a TFileStream instance is returned. The instance can be used to read or write data. The optional Access parameter allows you to specify whether the file should be opened in read, write, or read-write mode. The following table lists the parameters expected by this method.



Name Meaning

Path

The path to the file that will be opened.

Mode

The mode in which the file will be opened.

Access

The desired file access.



Note: Open raises an exception if the file cannot be opened or the path is invalid. Depending on the Mode and Access parameter combinations, several exception conditions can appear.

See Also