----- Original Message ----- 
From: "Stephen Downs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 23, 2004 8:49 PM
Subject: [fpc-pascal]Apple Mac pointer problem


I am porting a Mac CodeWarrior project to FreePascal and have hit a
compile problem with a pointer. In my original code I have a structure
defined along the lines of

testData = record
   testIndex :  array [0..12] of integer;
end;

testDataPointer = ^testData;
testDataHandle = ^testDataPointer;

Within my main code I open a file and try to read it into my structure

testDataHdl := testDataHandle(NewHandleClear(sizeof(testData)));
OSError := FSRead(fileRefNum, numberOfBytes, testDataHdl^)

The FSRead line fails with error: 62: Incompatible type for arg no. 3:
Got "testDataPointer", expected "Ptr" - the third parameter for FSRead is a
pointer. I presume this is because FreePascal uses typed pointers. I
tried replacing testDataHdl^ by Ptr(testDataHdl)^ but that gives a
similar error - Got "ShortInt", expected "Ptr"

Does anyone know how I can get around this?

regards... Steve

Euhm... just my two cents:

testDataHdl is in fact a pointer to a pointer to data.

so testDataHdl^ points to a pointer.

If you want to read a pointer from the file that's good.

But if you actually want to read the data then it's a mistake.

Then you need to use this:

testDataHdl^^

Bye,
  Skybuck.


_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to