procedure TForm23.Button4Click(Sender: TObject); var pstr:Pchar; mestr,Str1:string; FS:TFilestream; meint,PoStr,I,LenStr:integer; Fpos:Int64; TT,IsDay:Boolean; Liststr:TStringList; begin if not Self.OpenDialog1.Execute then Exit; FS:=TFileStream.Create(Self.OpenDialog1.FileName,fmOpenRead); meint:=1024; getmem(pstr,meint);//申请字符指针内存 TT :=False; I:=0; Liststr :=TStringList.Create; try while not TT do begin Fpos:=I*meint; FS.Position:=Fpos; fs.Readbuffer(pstr^,meint); if True then mestr:=pstr; SetLength(mestr,meint); Liststr.Text:=mestr; if i=0 then Self.Memo1.Text:=Liststr.Text; Self.Edit1.Text :=IntToStr(Liststr.Count); i:=i+1; if i>2 then TT :=True; end; finally freemem(Pstr);//释放内存 FS.Free;//释放流 Liststr.Free; end; end;
,相关文章
- 利用Java的缓冲流读取文本文件的数据
- Python实现逐行读取文本文件的六种方法
- Java:InputStream读取文本文件内容出现乱码问题的解决方法
- 如何利用C/C++逐行读取txt文件中的字符串(可以顺便实现文本文件的复制) (转)
- 用c#读取文件内容中文是乱码的解决方法:
- php中读取文件内容的几种方法。(file_get_contents:将文件内容读入一个字符串)
- 文件_ _android从资源文件中读取文件流并显示的方法
- 关于 Delphi 中流的使用(2) 用 TFileStream(文件流) 读写
- Java 用jxl读取excel并保存到数据库(此方法存在局限,仅限本地电脑操作,放在服务器上的项目,需要把文件上传到服务器,详细信息,见我的别的博客)
- 用Java IO流替换文件中的字符串