System.Classes.TCustomMemoryStream.Seek

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;

C++

virtual __int64 __fastcall Seek(const __int64 Offset, TSeekOrigin Origin)/* overload */;
inline int __fastcall  Seek(int Offset, System::Word Origin){ return TStream::Seek(Offset, Origin); }
inline __int64 __fastcall  Seek _DEPRECATED_ATTRIBUTE0 (const __int64 Offset, System::Word Origin){ return TStream::Seek(Offset, Origin); }

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes TCustomMemoryStream

Description

Moves the current position of the stream by Offset bytes, relative to the origin specified by Origin.

Use Seek to move the current position within the memory stream by the indicated offset. Seek allows an application to read from or write to a particular location within the Memory associated with the memory stream.

If Offset is a negative number, the seeking is backward from the specified origin. The following table shows the different values of Origin and their meanings for seeking:

Value Meaning

soBeginning

Offset is from the beginning of Memory. Seek moves to the position Offset. Offset must be >= 0.

soCurrent

Offset is from the current position. Seek moves to Position + Offset.

soEnd

Offset is from the end of Memory. Offset must be <= 0 to indicate a number of bytes before the end of the memory buffer.

Seek returns the new value of the Position property.

Note: Seek does no error checking on the value provided for Offset. Do not call Seek with an offset that would move the current position less than 0 (before the start of Memory) or greater than Size (beyond the end of the memory buffer).

See Also

Code Examples