list :TStringList;list:=TStringList.Create;
list.LoadFromFile("c:\abc.dat");
list[n-1] 就是第n行内容
list.LoadFromFile("c:\abc.dat");
list[n-1] 就是第n行内容
解决方案 »
- 用指针和WriteProcessMemory修改内存的问题
- dbgrid的hint显示不出来?
- 关于word导出的问题,急!!!
- delphi5问题,请各位大虾帮忙-急
- 动态链接库问题,下面这段dll代码有什么问题??
- 关于操作系统Unix与win2000共存的讨论!
- 我用的是delphi7.0 可是怎么也找不到 TToolButton 这个对象?
- delphi编译的exe程序在有的电脑上运行后就自动被关闭掉了
- 请问精通com的高手,能否在com对象中返回一个sream类型变量
- 3000左右高价求购钻石 ATLAS 10K Ⅲ-320 SCSI硬盘!
- 谁能告诉我!!! 谁能回答我!!
- SQL语句中,如果一个字符串类型的数据(如VarChar(a)),实现a<300,应该怎么做?
mytextfile:textfile;
s:string[255];
i:integer;
j:integer;
begin
assinfile(mytextfile,'mytextfile.txt');
reset(mytextfile);
try
while not eof (mytextfile) do
begin
readln(mytextfile,s,j)
memo1.lines.add(s+inttostr(j));
end;
finally
closefile(mytextfile);
end;
end;
memo1.lines[I -1]--第i行记录
var
f:tfilestream; +--------------可能拼错了,你还是查查帮助吧
s:array[1..255] of char; |
begin \/
f:=tfilestream.create('c:\abc.txt',fmonlywrite);
f.read(s,255);
...处理过程
f.free;
end;
要还有什么问题的话Mailto:[email protected]
我忘说了
要是想到下一行的话
还要在f.read(s,255);前加一行
f.seek(n*255,0);
用流来处理会很方便的:)
var
f:tfilestream;
s:array[1..255] of char;
begin
f:=tfilestream.create('c:\abc.txt',fmOpenWrite);
f.seek(n*255,soFromBeginning)
f.read(s,255);
...处理过程
f.free;
end;
要还有什么问题的话Mailto:[email protected]
方法1: 流
方法2:Tstrings;
方法3:文件操作。
var
f:tfilestream;
s:array[1..255] of char;
begin
f:=tfilestream.create('c:\abc.txt',fmOpenReadWrite);
f.seek(n*255,soFromBeginning)
f.read(s,255);
...处理过程
f.free;
end;
要还有什么问题的话Mailto:[email protected]