I have a program that uses 10 checkboxes. Each checkbox calls a different function. 7 of them relate to, and expect, small files so I am just using TFileStream.LoadFromFile to load the whole sourcefile to memory and "do stuff" with it there.
The other 3 expect large files - tens or hundreds of Gb. I tried to use Streams, specifically FileStream.ReadBuffer and KPJComp tried to help me out but his fine and full examples threw me a bit.
Yes, I have read the link referred to several times, particulary the part about binary files of course. But the example, like many examples on the net, is a very quick and small example that either refer to loading files in full into a buffer (not possible with huge files) or refers more to writing new files than reading existing ones.
I realise I can use FS.ReadBuffer (if buffer size is known), FS.Read (if buffer size is not known), FS.Size (for getting the size of the file) FS.Position (for knowing where you are in the file) and one or two others. But putting them together is what keeps defeating me. I tried something like:
while SF.Position <= SF.Size repeat
SF.ReadBuffer(Buffer, SizeOf(Buffer);
etc etc but then I kept hitting stumbling blocks relating to variable types not being compatible with what the stream returns, etc. So eventually I gave up and recoded it to the older way, as coded above. However, the problem I have now is I have 7 checkboxes expecting a FileStream and 3 that don't and instead use a file assignent. I then end up with a problem if the user selects all of the checkboxes because there are issues with releasing the stream and it then not being available for the next function. So, I'm trying hard to get it all back to streams as they seem more flexible, thus my question, but they also seem harder to use (to me).