Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Saving a TFileStream

Posted on 2004-08-09
3
Medium Priority
?
383 Views
Last Modified: 2010-04-05
I am using a TFileStream, is there anyway to save the stream apart from uing free. I am opening the stream
    oStream := TFileStream.Create( sFilename, fmShareExclusive or fmOpenReadWrite );

I keep the file open so no one else can open it, the user needs to be able to click save at any time and I need to save all changes up to that point.

0
Comment
Question by:julianpointer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:wolsen
ID: 11759440
you could just create another file stream and copy that stream to it.
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 11760336
or you can use LockFile() function to protect the file from being written (or read) by other process...
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 11760903
Well, when you write to the stream, it should be written to disk immediately. That's basic behaviour for filestreams... By using free, you also force the buffers to be written.  But in general these buffers are handled by Windows, not by the stream itself. You could try:

  FlushFileBuffers(oStream.Handle);

just in case...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question