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)来指向上一个位置,然后把上一个文件内容显示出来········
解决方案 »
- 怎么用IDHTTP登陆QQ空间
- DEPHI 关于学生机何教师机的问题
- 数字不是0-9的整形,是1-15的整形,如果将重复多到少排序,然后大到小排序。15,15,15,10,10,5,3,2,1
- CheckListBox一行过长怎办?
- 把SQL 表里的数据输出为txt
- 大家都用什么工具HOOK API?我用auto debug for windows,不过在win xp下不好用:(。
- 有两张结构完全相同的表A1和A2,现要表A的内容复制到A2表末尾中,请问SQL语句该怎么写呀~!!!~~~?????????
- 怎么用nmftp控件解决断点续传的问题,最好提供源码和思路。
- 涉及TreeView的一个设计问题,非常有趣
- 26分(最多了)再次倡议发贴子的时候请把关键问题描述好,便于大家搜索!!!而不是“请教大家”这样的标题[无内容]
- DBGRIDEH上右键从粘贴板上粘贴文本
- 求一个能下载到 Eureka Exception Log 的地方
listbox1.Items.Clear;
seek(f,pos-1);--这句会不会跳到-1的位置呢。
不会,哈哈