文件以2进制流形式保存,打开。 保存,打开后。如果数据不正确,则将 保存数据 的顺序 调整后,则打开文件 数据正常。请问这是如何造成的,如何解决?请指教。
SaveClassDataToChar(var Len: Integer; var Buf: array of Char);
var
    op, P: PChar;begin
    p := Buf;
    op := p;    move(FBoardColor, P^, sizeof(FBoardColor));
    P := P + sizeof(FBoardColor);    move(FFillColor, P^, sizeof(FFillColor));
    P := P + sizeof(FFillColor);    move(FIOType, P^, sizeof(FIOType));
    P := P + sizeof(FIOType);    move(FLocation1.X, P^, sizeof(FLocation1.X));
    P := P + sizeof(FLocation1.X);     move(FLocation1.Y, P^, sizeof(FLocation1.Y));
    P := P + sizeof(FLocation1.Y);    move(Forientation, P^, sizeof(Forientation));
    P := P + sizeof(Forientation);    Len := P - Op;LoadClassDataFromChar(var Buf: array of Char);
var
    P: PChar;
begin
    p := Buf;    move(P^, FBoardColor, sizeof(FBoardColor));
    P := P + sizeof(FBoardColor);    move(P^, FFillColor, sizeof(FFillColor));
    P := P + sizeof(FFillColor);    move(P^, FIOType, sizeof(FIOType));
    P := P + sizeof(FIOType);    move(P^, FLocation1.X, sizeof(FLocation1.X));
    P := P + sizeof(FLocation1.X);
    move(P^, FLocation1.Y, sizeof(FLocation1.Y));
    P := P + sizeof(FLocation1.Y);
    FJunction.Location:=FLocation1;    move(P^, Forientation, sizeof(Forientation));
    P := P + sizeof(Forientation);
    
    end;