我已经定义了一个记录,其中包含许多不同类型的字段(整数,实数,字符串,...以及"数组..."的动态数组).我想将它作为一个整体保存到文件中,然后能够将其加载回我的程序.我不想单独保存每个字段的值.文件类型(二进制或ascii或...)并不重要,因为Delphi可以将其读回记录.
你有什么建议吗?
我在Delphi 2009中有以下结构:
type
IndiReportIndi = record
IndiName: string;
NameNum: integer;
ReportIndiName: string;
end;
var
XRefList: array of IndiReportIndi;
Run Code Online (Sandbox Code Playgroud)
其中XRefList是动态数组.
我想将XRefList保存到FileStream.我该怎么做并包括所有IndiName和ReportIndiName字符串,以便以后从FileStream加载时它们都可以再次检索?