Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6112989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:48:27+00:00 2026-05-23T14:48:27+00:00

I make a very simple log with tstringlist. I write it to file: pLog.SaveToFile(FileName);

  • 0

I make a very simple log with tstringlist. I write it to file:

pLog.SaveToFile(FileName);

Somewhere there is a bug, and my computer is shut-down.
After, I cannot find my log file. Probably the file is saved in asych mode.
There is a way for waiting for the write before to go on with the execution?

Thanks,
Alberto

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:48:28+00:00Added an answer on May 23, 2026 at 2:48 pm

    If the savetofile call is at the program end, and the program terminates abnormally, then this call probably won’t execute. I use a logging mechanism which for every log call opens the log file, writes the log text and time, flushes and then closes the log file. This way, the log text is guaranteed to be written to a file, even if the program terminates abnormally.

    Here’s the code:

    procedure TMainForm.Log (const s: string);
    var
     f: textfile;
    
    begin
     assignfile (f, logfilename);
     {$I-}  // yes, I know: modern programming style requires a try/except block
     append (f);
     if ioresult <> 0 then rewrite (f);
     {$I+}
     writeln (f, datetostr (now), ' ', timetostr (now), ' ', s);
     flush (f);
     closefile (f);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm planning to make a very simple program using php and mySQL. The main
I'm attempting to make a very simple 2-person chatroom for my Django site. I'm
I am trying to make a very simple object rotate around a fixed point
I am trying to make a very simple web-service which does the following: The
I'm creating a very simple django upload application but I want to make it
I'm currently writing a very simple game engine for an assignment and to make
Hope you are fine. I have to make a Web Project (very simple) I
We have a very simple ASP.Net page for uploading a file to our webserver.
I'm trying to make a very simple toggle switch and I want to store
I wrote a very simple perl script, and now I want to make it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.