我知道将一个文件的一行读入一个textfile变量中用readln
可是我要通篇将一个文件的所有内容读入变量,然后对其操作,用什么阿 ?
谢谢!
可是我要通篇将一个文件的所有内容读入变量,然后对其操作,用什么阿 ?
谢谢!
解决方案 »
- 使用 ClientDataset 查询Access paramcheck问题
- 请问,ACCESS中的表格控件在Delphi中如何调用?
- adotable与adoquery在完成数据修改、添加、删除等操作时的区别?
- 如何才能让我的程序随IE一同启动
- 如何设置这样的时间列,存储为200020209但显示给用户的是2002/02/09
- 用PrintDialog控件进行打印设置的问题?? 高分!!!!
- DELPHI adodataset 控件 NewRecord 事件问题
- Delphi中如何处理超过255字节的字符串。。。
- 工具栏图标显示的简单问题
- 请问我是不是中了木马?
- 谁能帮我想一下!!可以加分!!
- 各位高手请看:在SQL Server中一点儿问题都没有,在ACCESS中就不行,请能帮我解决?
FList: TStringList;
tmpStr: String;
Begin
FList:= TStringList.Create;
FList.LoadFromFile(TextFileName);
iFileHandle: Integer;
iFileLength: Integer;
iBytesRead: Integer;
Buffer: PChar;
i: Integer
begin
if OpenDialog1.Execute then
begin
try
iFileHandle := FileOpen(OpenDialog1.FileName, fmOpenRead);
iFileLength := FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
Buffer := PChar(AllocMem(iFileLength + 1));
iBytesRead = FileRead(iFileHandle, Buffer, iFileLength);
FileClose(iFileHandle); for i := 0 to iBytesRead-1 do
begin
StringGrid1.RowCount := StringGrid1.RowCount + 1;
StringGrid1.Cells[1,i+1] := Buffer[i];
StringGrid1.Cells[2,i+1] := IntToStr(Integer(Buffer[i]));
end;
finally
FreeMem(Buffer);
end;
end;
end;
S: TFileStream;
begin
if OpenDialog1.Execute then
begin
S := TFileStream.Create (OpenDialog1.FileName, fmOpenRead);
try
Memo1.Lines.LoadFromStream(S);
finally
S.Free;
end;
end;
end;