System.Classes.TMemoryStream.LoadFromFile
Delphi
procedure LoadFromFile(const FileName: string);
C++
void __fastcall LoadFromFile(const System::UnicodeString FileName);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | System.Classes.pas System.Classes.hpp |
System.Classes | TMemoryStream |
Description
Loads the entire contents of a file into the memory buffer.
Use LoadFromFile to fill the memory stream with the contents of a file. Pass the name of the file as the FileName parameter. LoadFromFile allows an application to read the contents of a file into the memory stream without having to explicitly create and free a file stream object.
LoadFromFile reallocates the memory buffer so that the contents of the file will exactly fit. It sets the Size property accordingly, and then reads the entire contents of the file into the memory buffer. Thus, LoadFromFile will discard any pre-existing data stored in the memory stream.