Thread: Checking if a file is closed

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    932

    Checking if a file is closed

    I want my program to detect when a file is closed in order to encrypt it again.

    Is there a better way to do this than checking periodically the process list if the program opened the file is still open?
    Using Windows 10 with Code Blocks and MingW.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Does your decrypt/encrypt program run say the editor as a sub-process?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    932
    No, not sub-process, just opens a file simply.

    But you gave me an idea, maybe if I open it up from a thread I could check for the thread if its still running.
    Using Windows 10 with Code Blocks and MingW.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-06-2012, 02:46 PM
  2. Help with file checking
    By Alegomaster in forum C Programming
    Replies: 5
    Last Post: 01-21-2011, 07:36 PM
  3. Checking if file exists?
    By Neo1 in forum C++ Programming
    Replies: 8
    Last Post: 08-16-2007, 04:06 PM
  4. checking for end of file
    By linucksrox in forum C Programming
    Replies: 7
    Last Post: 06-01-2004, 01:41 AM
  5. Checking if I'm at end of file?
    By JOsephPataki in forum C Programming
    Replies: 5
    Last Post: 05-19-2003, 05:27 PM

Tags for this Thread