

Good solution, but sadly I have dynamic arrays, too. Strm.Read(aArray, SizeOf * iCount) //then read content SetLength(aArray, iCount) //then alloc mem Strm.Read(iCount, Sizeof(iCount) ) //first read the length Strm.Write(aArray, SizeOf * iCount) //then write content Strm.Write(iCount, Sizeof(iCount) ) //first write our length In case you want to write dynamic content: Strm.Write(ra, SizeOf(TTestRecord) * Length(ra)) Type TRecordArray = array of TTestRecord You can even load or save an array of record at once! Strm.Write(rTestRecord, Sizeof(TTestRecord) ) So if you use strings, you need to make them fixed:

You can load and save the memory of a record directly to and from a stream, as long as you don’t use dynamic arrays. The file type (binary or ascii or …) is not important as long Delphi could read it back to a record. I don’t want to go through saving each field’s value individually. I want to save it as a whole to a file and then be able to load it back to my program. I have defined a record which has lots of fields with different types (integer, real, string, … plus dynamic arrays in terms of “array of …”).
