help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'Classes' (#rtl)

TCustomMemoryStream.SaveToFile

Writes the contents of the stream to a file.

Declaration

Source position: classesh.inc line 688

public procedure TCustomMemoryStream.SaveToFile(

  const FileName: String

);

Description

SaveToFile writes the contents of the stream to a file with name FileName. It simply creates a filestream and writes the contents of the memorystream to this file stream using TCustomMemoryStream.SaveToStream.

Remark:

This method will work much faster than the use of the TStream.CopyFrom method:

Stream:=TFileStream.Create(fmCreate,FileName);
  Seek(0,soFromBeginning);
  Stream.CopyFrom(Self,Size);

because the CopyFrom method copies the contents in blocks, while SaveToFile writes the contents of the memory as one big block.

Errors

If an error occurs when creating or writing to the file, an EStreamError exception may occur.

See also

TCustomMemoryStream.SaveToStream

  

Writes the contents of the memory stream to another stream.

TFileStream

  

Stream that stores its data in a named file on disk.

TStream.CopyFrom

  

Copy data from one stream to another

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505