hsauro 40 Posted November 19, 2018 What is the advantage of using TFileStream with TStreamReader compared passing the filename directly to TStreamReader? For example, what is the difference between these two: f = TStreamReader.Create (fileName) or f = TStreamReader.Create (TFileStream.Create (fileName, fmOpenRead)) Share this post Link to post
Dave Nottage 559 Posted November 19, 2018 (edited) TStreamReader.Create (fileName) passes the flags as: fmOpenRead or fmShareDenyWrite Sadly, none of the overloads allow you to change this. Worse still: its counterpart TStreamWriter.Create can fail on platforms other than iOS because the flags don't include fmShareDenyWrite Edited November 19, 2018 by Dave Nottage 1 Share this post Link to post
hsauro 40 Posted November 19, 2018 Thanks for that. So it's better to use f = TStreamReader.Create (TFileStream.Create (fileName, fmOpenRead)) because one has more control over the flags. Share this post Link to post