浏览代码

* Implement TFile.OpenText

Michaël Van Canneyt 1 年之前
父节点
当前提交
b7b665d273
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      packages/vcl-compat/src/system.ioutils.pp

+ 12 - 1
packages/vcl-compat/src/system.ioutils.pp

@@ -1963,8 +1963,19 @@ begin
 end;
 
 class function TFile.OpenText(const aPath: string): TStreamReader;
-begin
 
+var
+  F : TFileStream;
+  
+begin
+  Result:=Nil;
+  F:=TFilestream.Create(aPath,fmOpenRead or fmShareDenyWrite);
+  try  
+    Result := TStreamReader.Create(F,BUFFER_SIZE,True);
+  except
+    F.Free;
+    Raise;
+  end
 end;
 
 class function TFile.OpenWrite(const aPath: string): TFileStream;