next up previous contents index
Next: Random Up: Functions and Procedures Previous: Power

Ptr

   

Declaration:

Function Ptr (Sel,Off : Longint) : Pointer;

Description:

Ptr returns a pointer, pointing to the address specified by segment Sel and offset Off.

Remark 1: In the 32-bit flat-memory model supported by Free Pascal, this function is obsolete.

Remark 2: The returned address is simply the offset. If you recompile the RTL with -dDoMapping defined, then the compiler returns the following : ptr:=pointer($e0000000+sel shl 4+off) under DOS, or ptr:=pointer(sel shl 4+off) on other OSes.

Errors:

None.

See also:

Addr

Example
Program Example59;

{ Program to demonstrate the Ptr function. }

Var P : ^String;
    S : String;
    
begin
  S:='Hello, World !';
  P:=Ptr(Seg(S),Longint(Ofs(S)));
  {P now points to S !}
  Writeln (P^);
end.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998