## Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

• Help others & share knowledge
• Earn cash & points
Solved

# Pointers in Delphi 32

Posted on 1998-01-02
927 Views
My problem is, I have to increment a pointer.
In old 16 bit code, I does it by use
p := ptr(seg(p^),ofs(p^) + n);
but this is not longer possible in delphi 32. So how can I do the
same stuff in 32bit?
Here is some dummy code to make my problem more understandable...
Type
Rec = record
size: integer;
data: array[0..0] of byte;
end;
prec = ^rec;
var
p : pointer;
numberofrec: integer;
begin
getmem(p,filestream.size);
interpretrec(p,numberofrec);
filestream.free;
end;
procedure interpretrecs(var p; numberofrec: integer);
var
myrec: prec;
begin
myrec := @p;
while numberofrec > 0 do
with myrec^ do
begin
dosomething with myrec
// not possible in 32 bit
myrec := Ptr(Seg(myrec^),Ofs(myrec^)+Size);
dec(numberofrec);
end;
end; *)

--
info@cpfreiburg.de
0
Question by:karlhfreiburg

LVL 1

Accepted Solution

hustch earned 100 total points
ID: 1355110
In Delphi 32, you don't use the segment any more, the 32-bit pointer is an offset.
You can add Size to your pointer directly. If the Compiler won't let you do it with a pointer of type prec, you can typecast it to type PChar (myrec := prec(PChar(myrec)+size);)
0

LVL 5

Expert Comment

ID: 1355111
Maybe Size here is meant to be SizeOf(Rec)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…