System.Classes.TFileStream.Create
Delphi
constructor Create(const AFileName: string; Mode: Word); overload;
constructor Create(const AFileName: string; Mode: Word; Rights: Cardinal); overload;
C++
__fastcall TFileStream(const System::UnicodeString AFileName, System::Word Mode)/* overload */;
__fastcall TFileStream(const System::UnicodeString AFileName, System::Word Mode, unsigned Rights)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
constructor | public | System.Classes.pas System.Classes.hpp |
System.Classes | TFileStream |
Description
Create creates an instance of TFileStream.
Call Create to instantiate a file stream for reading from or writing to the named file. Specify the name of the file and the way the file should be opened as parameters.
The Mode
parameter indicates how the file is to be opened. The Mode
parameter consists of an open mode and (possibly) a share mode or'ed together. The open mode must be one of the following values.
Value | Meaning | Declared In |
---|---|---|
Create a file with the given name. If a file with the given name exists, override the existing file and open it in write mode. |
||
Automatically creates the file only if it does not exist, otherwise fails. |
||
Open the file for reading only. |
||
Open the file for writing only. Writing to the file completely replaces the current contents. |
||
Open the file to modify the current contents rather than replace them. |
The share mode must be one of the following values:
Value | Meaning | Declared In |
---|---|---|
Sharing is compatible with the way FCBs are opened. |
||
Other applications cannot open the file for any reason. |
||
Other applications can open the file for reading but not for writing. |
||
Other applications can open the file for writing but not for reading. |
||
No attempt is made to prevent other applications from reading from or writing to the file. |
Rights
parameter is ignored.If the file cannot be opened, Create raises an exception.