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 320803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:47:14+00:00 2026-05-12T08:47:14+00:00

I have a console-mode program that uses SQLite3 to maintain a database file. It

  • 0

I have a console-mode program that uses SQLite3 to maintain a database file. It takes a while to execute, but it should be safe at any point to cancel, assuming that the database writes happen. (This is all under Windows)

Is it any safer, from the point of a running program, to hit CtrlC in the console than to have another program call TerminateProcess on it?

I’ve noticed that I can get database corruption if TerminateProcess is called- I assume that this is because the program does not get a chance to finish writes. My guess is that CtrlC is better, because the program gets a signal and terminates itself, rather than the OS killing it.

Note that the program doesn’t actually handle the signal (unless SQLite does); I’m talking about the built-in default mechanisms of Win32 executables to handle the CtrlC signal.

To clarify/simplify the question- given that this write has just executed:

fwrite(buf, 1024*1024, 1, stream);

During this write, will TerminateProcess behave differently from CtrlC?

  • 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-12T08:47:14+00:00Added an answer on May 12, 2026 at 8:47 am

    All of these are compelling arguments, but the only way to know for sure is to try it. So I wrote a simple program that allocates a 1GB buffer, assigns some data to it, then writes it to a file using a single fwrite(). I tried several methods to get the write to “corrupt” the data (I was expecting a truncated file, specifically):

    • Calling TerminateProcess (via perl’s kill function and Win32::Process::Kill)
    • Hitting CtrlC
    • Using Task Manager’s “End Process”
    • Using Process Explorer’s “Kill Process”

    Nothing would stop the write- in every case, the file was the correct size and had the correct data. And although the “Kill” would happen instantly, the process would linger until the write had completed.

    It seems conclusive that there is no difference between TerminateProcess and CtrlC from an I/O point of view- once the write starts, it seems guaranteed to complete (barring power outages).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How about using the getiterator method to iterate through the… May 16, 2026 at 9:55 pm
  • Editorial Team
    Editorial Team added an answer the general setup of swfAddress is to work with the… May 16, 2026 at 9:55 pm
  • Editorial Team
    Editorial Team added an answer This issue might be specific to my site, but perhaps… May 16, 2026 at 9:55 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a mixed mode C++-CLI program in Visual Studio 2005 that is set
I have a Windows Service written in C#. It includes a standalone console mode
I have a console application that I didn't write. Is there some easy way
I have a console that I want to use to invoke commands on a
I have a Qt application in Visual Studio 2005 which is linked using \subsystem:windows such that
I have a client (a Unit Test) that call to WCF Service (hosting in
I have a WebService that I am trying to use NetTCPBinding on. here is
I have a console application from which I create a window. I can render
Well, I have a simple question, at least I hope its simple. I was
I am using boost serialization with xml files with a C++ program. When I

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.