From 54dee0796434b17b667f4d58c52e21cf9685a97a Mon Sep 17 00:00:00 2001 From: jesus Date: Fri, 24 Apr 2015 04:53:00 +0000 Subject: [PATCH] LazUtils, cvsutils: load from file version git-svn-id: trunk@48825 - --- components/lazutils/lcsvutils.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/lazutils/lcsvutils.pas b/components/lazutils/lcsvutils.pas index bf2b858bdd..bffbf7c1b7 100644 --- a/components/lazutils/lcsvutils.pas +++ b/components/lazutils/lcsvutils.pas @@ -14,6 +14,8 @@ type procedure LoadFromCSVStream(AStream:TStream; AProc: TCSVRecordProc; ADelimiter:Char=','; CSVEncoding:TCSVEncoding=ceAuto); + procedure LoadFromCSVFile(aFilename: string; AProc: TCSVRecordProc; + ADelimiter:Char=','; CSVEncoding:TCSVEncoding=ceAuto); implementation @@ -262,5 +264,18 @@ begin end; end; +procedure LoadFromCSVFile(aFilename: string; AProc: TCSVRecordProc; + ADelimiter: Char; CSVEncoding: TCSVEncoding); +var + Stream: TFileStream; +begin + Stream := TFileStream.Create(aFilename, fmOpenRead); + try + LoadFromCSVStream(Stream, AProc, ADelimiter, CSVEncoding); + finally + Stream.Free; + end; +end; + end.