在自己編寫文本文件讀取函數的時候
function IsTextFile(FileName:string):boolean;
var
Fs:TFileStream;
i
IsTextFile:boolean;
ByteData:Byte;
begin
if FileExists(FileName) then
begin
Fs:=TFileStream
IsTextFile:=true;
i:=
size:=Fs
While (i<size) and IsTextFile do
begin
Fs
IsTextFile:=ByteData<>
inc(i)
end;
Fs
Result:=IsTextFile
end
else
Result:=false
end;
From:http://tw.wingwit.com/Article/program/Delphi/201311/24729.html