Op 2020-10-05 om 20:45 schreef Ryan Joseph via fpc-pascal:
I often need to use a function which reads a file into a string, as is so
common in so many scripting languages. Can it be considered to add something
like this to the RTL? Since we have a refcounted Ansistring type it's natural
for this to be a one-liner. Not saying we should use TStringList but that's the
closest thing I found in the RTL.
function ReadFile(path: Ansistring): Ansistring;
var
list: TStringList;
begin
list := TStringList.Create;
list.LoadFromFile(ExpandFileName(path));
result := list.Text;
list.Free;
end;
Stringlist static method loadstringfromfile ?
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal