将记录类型保存到文件....
边缘998 2008-10-10 01:16:22 unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type //定义文件结构
PMyData=^TMyData;//声明结构指针
TMyData=Record
Name:String;
Age:Integer;
Birthday:TDateTime;
end;
TMyDataFile=file of TMyData;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SaveDialog1: TSaveDialog;
OpenDialog1: TOpenDialog;
ReadMemo: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function SaveToFileMath1(FileName:String;Data:TMyData):Boolean;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
上面代码在DELPHI7中运行时提示红色部分出错.
错误如下:
[Error] Unit1.pas(16): Type 'TMyData' needs finalization - not allowed in file type
我记是记录类型文件是这样定义的,可今天试了下不行,为什么?哪里少了?