tfilestream

How to flush a TFileStream?

TFileStream provides buffered output, which is great in most cases, but in some cases (especially during debugging) it's nice to flush the buffer immediately. Thing is, I don't know of any way to do that except calling Free, which is kind of counterproductive. Is there a better way to do it? ...

(Wide)String - storing in TFileStream, Delphi 7. What is the fastest way?

Hi, I'm using Delphi7 (non-unicode VCL), I need to store lots of WideStrings inside a TFileStream. I can't use TStringStream as the (wide)strings are mixed with binary data, the format is projected to speed up loading and writing the data ... However I believe that current way I'm loading/writing the strings might be a bottleneck of my ...

tfilestream.seek and offset confusion

this is a code snippet taken from https://forums.embarcadero.com/message.jspa?messageID=219481 if FileExists(dstFile) then begin Fs := TFileStream.Create(dstFile, fmOpenReadWrite); try Fs.Seek(Max(0, Fs.Size-1024), soFromBeginning); // alternatively: // Fs.Seek(-1024, soFromEnd); Http.Request.Range := IntToStr(Fs.Pos...

File not recieved if I free the instance of filestream anywhere?

I am trying to send a file using TServerSocket/TClientSocket. The file is sent completely as long as I do not free the filestream anywhere and by anywhere I mean form.OnCreate event too. If I do free anywhere only 1 or 2 percent is sent. I also have to put the TFileStream.Create line of code on the server side OnCreate event. If I creat...

Delphi TFileStream.Seek, how to check for invalid seek offset

I am working with TFileStream in Delphi 2006. When I invoke TFileStream.Seek with an offset that is out of bounds I am getting different return values. When I seek to a position below the beginning of the stream, the function returns -1 and if I seek to a beyond the stream size, the function returns what would have been the position in t...

how to detect if tfilestream has been freed?

is there a way to see if an instace of tfile stream is being used? for example if i declare FS of type tfilestream,write buffer to it and finally free the stream using tfilestream.free can i check something like: if tfilestream.NotActive then //code if tfilestream.beingused then //code if tfilestream.free = true then //code a...