如何在Delphi中将动态数组保存到FileStream?

我在Delphi 2009中有以下结构:
type
  IndiReportIndi = record
    IndiName: string;
    NameNum: integer;
    ReportIndiName: string;
  end;

var
  XRefList: array of IndiReportIndi;

其中XRefList是动态数组.

我想将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;

要将整个XRefList保存为流使用:

TKBDynamic.Writeto(lStream,XRefList,TypeInfo(TXRefList));

要加载它:

TKBDynamic.ReadFrom(lStream,TypeInfo(TXRefList));

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...