我在Delphi 2009中有以下结构:
type IndiReportIndi = record IndiName: string; NameNum: integer; ReportIndiName: string; end; var XRefList: array of IndiReportIndi;@H_502_4@其中XRefList是动态数组. @H_502_4@我想将XRefList保存到FileStream.我该怎么做并包括所有IndiName和ReportIndiName字符串,以便在我稍后从该FileStream加载时它们都可以再次检索?
解决方法
使用:
http://code.google.com/p/kblib/
type IndiReportIndi = record IndiName: string; NameNum: integer; ReportIndiName: string; end; TXRefList = array of IndiReportIndi; var XRefList: TXRefList;@H_502_4@要将整个XRefList保存为流使用:
TKBDynamic.WriteTo(lStream,XRefList,TypeInfo(TXRefList));@H_502_4@要加载它:
TKBDynamic.ReadFrom(lStream,TypeInfo(TXRefList));