0
The Pointer
and the pointer definition Delphi, some kind of dice. A pointer stores the address of a variable that is in memory, and through it you can access the value of the variable that the pointer is pointing to.
Example, accessing a string variable:
procedure TForm1.Button1Click(Sender: TObject);
var
pExemplo: Pointer;
vStr, r: string;
begin
vStr := 'exemplo ponteiro';
pExemplo := @vStr;//pExemplo recebe o endereço de vStr.
r := string(pExemplo^);//Aqui é feita a conversão da variável para string.
ShowMessage(r);
end;
The variable r
received the value of vStr
through the pointer pExemplo
.
More about pointers in Delphi here. I hope I’ve helped you.
This expression is wrong, not to convert the Pointer, vc have to convert the Pointer type variable.
– gato
I just didn’t express myself right, but you’re right.
– SCOFIELD