Back to the WFC main page

wfc_move_file_at_reboot

$Revision: 4 $

Declaration

void wfc_move_file_at_reboot( const CString& existing_file, const CString& file_to_move )

Description

This function allows you to replace a file at reboot. You normally need to do this when the file is constantly in use (like a DLL). The only time to replace the file is when it is not being used by the program that is always running. The only time to do this is when NT is rebooting. This is how operating system files get updated.

Example

#include <wfc.h>

int _tmain( int number_of_command_line_arguments, LPCTSTR command_line_arguments[] )
{
   WFCTRACEINIT( TEXT( "_tmain()" ) );

   if ( number_of_command_line_arguments < 3 )
   {
      _tprintf( TEXT( "Usage: moveatreboot source destination\n" ) );
      return( EXIT_FAILURE );
   }

   if ( wfc_move_file_at_reboot( command_line_arguments[ 1 ], command_line_arguments[ 2 ] ) != FALSE )
   {
      _tprintf( "Move OK\n" );
   }
   else
   {
      _tprintf( "Move not ok\n" );
   }

   return( EXIT_SUCCESS );
}

API's Used

wfc_move_file_at_reboot() uses the following API's:
Copyright, 2000, Samuel R. Blackburn
$Workfile: wfc_move_file_at_reboot.cpp $
$Modtime: 1/17/00 9:35a $