Yes, slightly: AStream.Read(FIntDblArray, Length(FIntDblArray) * SizeOf(TIntDblEelement)) FintDblArray is only a pointer, and Stream.Read expects var parameters, so you would be writing over the pointer, and not into the array. Joe Bren wrote: > I think I just answered my own question: > AStream.Read(FIntDblArray.anInt, Length(FIntDblArray) * > SizeOf(TIntDblElement)) AStream.Read(FIntDblArray.aDbl, > Length(FIntDblArray) * SizeOf(TIntDblElement)) > The above should be > AStream.Read(FIntDblArray, Length(FIntDblArray) * > SizeOf(TIntDblElement)) > The same for the 'Write' as well. Marc Rohloff marc -at- marc rohloff -dot- com. You should be able to replace the whole block above: AStream.Write(FIntDblArray, Length(FIntDblArray) * SizeOf(TIntDblElement) ) and read everything in one go. On Tue, 09:20:08 -0700, Joe Bren wrote: > for i:= 0 to High(FIntDblArray) do > begin > AStream.Write(FIntDblArray.anInt, Length(FIntDblArray) * SizeOf(TIntDblElement)) > AStream.Write(FIntDblArray.aDbl, Length(FIntDblArray) * SizeOf(TIntDblElement)) > end > end As before you can write th block in one go (The only time this isn't true is when your record contains reference types). Delphi 7, Delphi 2007 or Delphi 2009), you won't be able to automatically serialize records as plain JSON objects directly. If your application is developped on any older revision (e.g. Sadly, the information needed to serialize a record is available only since Delphi 2010.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |