Your question is slightly confusing. I can't imagine that you are trying to actually write the pointers themselves (they would very likely be invalid when you read them back), just the Int64s they point to. If that is the case, you are not doing it right.
If the array really contains pointers, then you can't write the items in one go. The pointers are in one contiguous block, but not necessarily the items they point to. You will have to write them one by one:
procedure Save(AFileHandle: THandle; AArray: TArray);
var
I: Integer;
begin
for I := Low(AArray) to High(AArray) do
FileWrite(AFileHandle, AArray[I]^, SizeOf(Int64));
end;
or, alternatively:
procedure Save(AFileHandle: THandle; AArray: TArray);
var
P: PInt;
begin
for P in AAray do
FileWrite(AFileHandle, P^, SizeOf(P^));
end;
And reading back:
procedure Load(AFileHandle: THandle; var AArray: TArray);
var
I: Integer;
begin
for I := Low(AArray) to High(AArray) do
begin
New(AArray[I]);
FileRead(AFileHandle, AArray[I]^, SizeOf(Int64));
end;
end;
You read and write SizeOf(PInt), but that would write the size of a pointer, not the size of an Int64.
As Sertac writes, you could write them in one go (and read them too), thus avoiding having to call FileWrite or FileRead repeatedly, if you copy the Int64s to a contiguous block first (assuming that each call to file I/O is much slower than copying the values to a single array):
type
PSaveArray = ^TSaveArray;
TSaveArray = array[0..5] of Int64;
procedure Save(AFileHandle: THandle; AArray: TArray);
var
Save: TSaveArray;
I: Integer;
begin
for I := 0 to 5 do
Save[I] := AArray[I]^;
FileWrite(AFileHandle, Save, SizeOf(Save));
end;
Reading back would be similar:
procedure Load(AFileHandle: THandle; var AArray: TArray);
var
Items: PSaveArray;
I: Integer;
begin
New(Items);
FileRead(AFileHandle, Items^, Sizeof(Items^));
for I := Low(Items) to High(Items) do
AArray[I] := Addr(Items^[I]);
end;