Ver Mensaje Individual
  #2  
Antiguo 18-04-2008
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.734
Reputación: 20
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
En el Help de Delphi 6
Overview of Pointers

Código Delphi [-]
var
  X, Y: Integer;   // X and Y are Integer variables
  P: ^Integer;     // P points to an Integer
begin
  X := 17;         // assign a value to X
  P := @X;         // assign the address of X to P
  Y := P^;         // dereference P; assign the result to Y
end;

Código Delphi [-]
type
  PInteger = ^Integer;
var
  R: Single;
  I: Integer;
  P: Pointer;
  PI: PInteger;
begin
  ...
  P := @R;
  PI := PInteger(P);
  I := PI^;
end;

En tu caso:

Código Delphi [-]
var
  i : integer;
  PB: ^Byte;
  PI: ^Integer;
  PW: ^Word;
  vByte : Byte;
  vInteger : Integer;
  vWord : Word;
begin 
   while not fin_de_buffer
   begin 
      inc(i);
      if (viene_un_word) then
      begin
         PW := @Buffer[i];
         vWord := PW^;
         i := i + 2;
      end;
      if (viene_un_integer) then
      begin
         PI := @Buffer[i];
         vInteger := PI^;
         i := i + 2;
      end;
      if (viene_un_byte) then
      begin
         PB := @Buffer[i];
         vByte := PB^;
         i := i + 1;
      end;
      ...

Última edición por duilioisola fecha: 18-04-2008 a las 11:43:40.
Responder Con Cita