Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-09

Still have problems with arrays...

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

C.Keck

Hi,
the tips you gave me on open arrays did not really solve my problem. Let me try to describe my problem a little more detailed:
- a program calls a procedure in a unit with some params, like:

testprocedure (x, y, z, @buffer, sizeof(Buffer));

- In fact the buffer is an array, but only in the program that calls the procedure
- so the procedure does only know the pointer to the buffer and the size of it.
- now I want to move the data within the procedure with an computed offset, e.g. move the data at @buffer+offset -> @buffer ... how can this be done?
- Is there any complementary to the "move"-command that can work with pointers?

Many thanks in advance again ;-)

Chris

Reply by email

Jonas Maebe
Show quoted text 8 lines
- In fact the buffer is an array, but only in the program that calls the procedure - so the procedure does only know the pointer to the buffer and the size of it. - now I want to move the data within the procedure with an computed offset, e.g. move the data at @buffer+offset -> @buffer ... how can this be done? - Is there any complementary to the "move"-command that can work with pointers?

Just declare a type like

type
  pbyte = ^byte;

and do

move((pbyte(buffer)+offset)^,pbyte(buffer)^,size);

Note that you should use buffer instead of @buffer, since you say buffer is already a pointer.

Jonas

Reply by email