procedure TForm1.Button9Click(Sender: TObject);
var
pos:integer;
p:precord;
f:file of precord;
begin
pos:=listbox1.ItemIndex;
assignfile(f,'f:\shuju2\p.dat');
pos:=listbox1.ItemIndex;
if fileexists('f:\shuju2\p.dat') then
reset(f)
else
rewrite(f);
seek(f,0);
listbox1.Items.Clear;
seek(f,pos-1);
while not eof(f) do
begin
read(f,p);
listbox1.Items.Add(p.xm+' '+p.sr+' '+p.dh+' '+p.xb+' '+p.mz+' '+p.ah);
edit1.Text:=p.xm;
maskedit1.Text:=p.sr;
maskedit2.Text:=p.dh;
end;
end;end.运行老是seek(f,pos-1);出错
我这段代码的目的是想,先通过 pos:=listbox1.ItemIndex;来确定文件的位置,然后通过seek(f,pos-1)来指向上一个位置,然后把上一个文件内容显示出来········
var
pos:integer;
p:precord;
f:file of precord;
begin
pos:=listbox1.ItemIndex;
assignfile(f,'f:\shuju2\p.dat');
pos:=listbox1.ItemIndex;
if fileexists('f:\shuju2\p.dat') then
reset(f)
else
rewrite(f);
seek(f,0);
listbox1.Items.Clear;
seek(f,pos-1);
while not eof(f) do
begin
read(f,p);
listbox1.Items.Add(p.xm+' '+p.sr+' '+p.dh+' '+p.xb+' '+p.mz+' '+p.ah);
edit1.Text:=p.xm;
maskedit1.Text:=p.sr;
maskedit2.Text:=p.dh;
end;
end;end.运行老是seek(f,pos-1);出错
我这段代码的目的是想,先通过 pos:=listbox1.ItemIndex;来确定文件的位置,然后通过seek(f,pos-1)来指向上一个位置,然后把上一个文件内容显示出来········
解决方案 »
- 文件检索能否实现汉字拼音模糊查询?
- FastReport可以把中间Master data的行数固定吗?
- 各位大哥请帮帮忙呀,关于存入图片路径的两个问题。
- 如何判断用户输入的TextEdit中的内容只包含中文。(即用户姓名中不能包含英文字母和数字)
- 请教一个小问题
- 如何设置themeengine控件中themememubar上菜单项的字体!
- 招delphi程序员(三个月短期项目,深圳福田区),熟悉网络应用开发、精通数据库应用开发
- 一年零三个月的坚持,终于感动了她---我最深爱的女友!!!
- 一个关于算法的问题!送大分!
- dbgrid的问题,谁能帮我解决呀!
- DBGRIDEH上右键从粘贴板上粘贴文本
- 求一个能下载到 Eureka Exception Log 的地方
listbox1.Items.Clear;
seek(f,pos-1);--这句会不会跳到-1的位置呢。
不会,哈哈