你要用什么格式保存啊?如果你的数据不算复杂的,直接用txt文本保存就行了。
或者可以参考股票软件的数据格式,使用类型文件存储。你要的是那一种?可以试图给个例子。
或者可以参考股票软件的数据格式,使用类型文件存储。你要的是那一种?可以试图给个例子。
解决方案 »
- DELPHI 7 调用 COM+
- 请问CoolTrayIcon的安装方法
- 使用存储过程时如何取得返回的值????急啊。
- 我编写了一个子父窗口,当子窗口增多时,程序使用内存非常大,我只有4个子窗口,就用了约40m的内存,如果窗口在增多,那么程序可能不能运
- 暴简单的问题!!
- 怎么创建一个文件夹 。送分:
- oracle的登陆
- 简单的SQL,第三次发问!!!
- 如何屏蔽SHIFT键?
- 如何在程序中定时?
- 如何把WideString的内容copy到PWideChar所指向的缓冲区中?急!!!!
- 我从98升级到2k,现在想装98,怎么把ntfs格式转为fat32的呀,谢谢。除了这个方法,还有别的方法装双系统启动吗?
SysUtils, Classes, ComCtrls, CheckLst;Type
TImportTextRec = record
Ext: string[5];
CanImport: boolean;
end; TImportTextObject = class
private
FFile: file of TImportTextRec;
function ExistsType(const Ext: string): boolean;
procedure GotoFileEnd;
procedure SetTextCanImport(const Ext: string; Value: boolean);
protected public
constructor Create;
destructor Destroy; override;
function AddTextType(const Ext: string; CanImport: boolean): boolean;
function CanImport(const Ext: string): boolean;
procedure DeleteTextType(const Ext: string);
procedure ShowAllType(CheckListBox: TCheckListBox);
procedure SaveAllType(CheckListBox: TCheckListBox);
end;implementationuses RainbowApi;{ TImportText }{-------------------- private --------------------}{ 判断一个类型是否存在 }
function TImportTextObject.ExistsType(const Ext: string): boolean;
var
ImportTextRec: TImportTextRec;
begin
result := false;
ReSet(FFile);
while not eof(FFile) do
begin
read(FFile, ImportTextRec);
if ImportTextRec.Ext = Ext then
begin
result := true;
break;
end;
end;
end;{ 文件指针指向文件尾 }
procedure TImportTextObject.GotoFileEnd;
var
ImportTextRec: TImportTextRec;
begin
ReSet(FFile);
while not eof(FFile) do
Read(FFile, ImportTextRec);
end;procedure TImportTextObject.SetTextCanImport(const Ext: string;
Value: boolean);
var
iPos: integer;
ImportTextRec: TImportTextRec;
begin
iPos := 0;
ReSet(FFile);
while not eof(FFile) do
begin
read(FFile, ImportTextRec);
if ImportTextRec.Ext = Ext then
begin
ImportTextRec.CanImport := Value;
seek(FFile, iPos);
write(FFile, ImportTextRec);
break;
end;
inc(iPos);
end;
end;
{-------------------- public --------------------}constructor TImportTextObject.Create;
begin
AssignFile(FFile, ProgPath + 'ImportText.dat');
if FileExists(ProgPath + 'ImportText.dat') then
ReSet(FFile)
else begin
ReWrite(FFile);
AddTextType('.txt', true);
AddTextType('.rtf', true);
AddTextType('.htm', true);
end;
end;destructor TImportTextObject.Destroy;
begin
CloseFile(FFile);
inherited;
end;function TImportTextObject.AddTextType(const Ext: string;
CanImport: boolean): boolean;
var
ImportTextRec: TImportTextRec;
begin
if ExistsType(Ext) then
result := false
else begin
GotoFileEnd; //指针到文件尾
ImportTextRec.Ext := Ext;
ImportTextRec.CanImport := CanImport;
write(FFile, ImportTextRec);
end;
end;function TImportTextObject.CanImport(const Ext: string): boolean;
var
ImportTextRec: TImportTextRec;
begin
result := false;
ReSet(FFile);
while not eof(FFile) do
begin
read(FFile, ImportTextRec);
if ImportTextRec.Ext = Ext then
begin
result := ImportTextRec.CanImport;
break;
end;
end;
end;procedure TImportTextObject.DeleteTextType(const Ext: string);
var
ImportTextRec: TImportTextRec;
iPos: integer;
begin
ReSet(FFile);
iPos := 0;
while not eof(FFile) do
begin
read(FFile, ImportTextRec);
if ImportTextRec.Ext = Ext then
begin
ImportTextRec.Ext := '';
Seek(FFile, iPos);
write(FFile, ImportTextRec);
break;
end;
inc(iPos);
end;
end;procedure TImportTextObject.ShowAllType(CheckListBox: TCheckListBox);
var
ImportTextRec: TImportTextRec;
begin
ReSet(FFile);
while not eof(FFile) do
begin
Read(FFile, ImportTextRec);
with CheckListBox do
if ImportTextRec.Ext <> '' then
begin
Items.Add(ImportTextRec.Ext);
Checked[Items.Count - 1] := ImportTextRec.CanImport;
end;
end;
end;procedure TImportTextObject.SaveAllType(CheckListBox: TCheckListBox);
var
i: integer;
begin
for i := 0 to CheckListBox.Items.Count - 1 do
begin
SetTextCanImport(CheckListBox.Items[i], CheckListBox.Checked[i]);
end;
end;end.
unit Umain;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
type
slonday = record
day: cardinal;
Oprice: cardinal;
Cprice: cardinal;
Hprice: cardinal;
Lprice: cardinal;
Damout: cardinal;
Dvolmn: cardinal;
reserved: Array[0..5] of smallint;
end;Fslon = file of slonday;var
Vslon : Fslon;
Vsday : Slonday;
implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Clear; AssignFile(vslon,'F:\SLON\DATA\SZ\DAY\0957.day');
Reset(Vslon);
while not Eof(Vslon) do
begin
Read(Vslon,Vsday);
Memo1.Lines.Add(inttostr(not Vsday.day)+','+inttostr(not Vsday.Oprice)+','
+inttostr(not Vsday.Cprice)+','+inttostr(not Vsday.Hprice)+','
+inttostr(not Vsday.lprice)+','+inttostr(not Vsday.Damout)+','
+inttostr(not Vsday.Dvolmn));
end;
CloseFile(Vslon);
end;end.
to taxi:能留下email吗?