#include "stdafx.h" #include <windows.h> #include <stdio.h> int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { WIN32_FIND_DATA FileData; HANDLE hSearch; hSearch = FindFirstFile("c:\\TEST\\test.dbf", &FileData); // CHeck if the file exists if (hSearch != INVALID_HANDLE_VALUE) { // File exists // Copy file c:\test\dbf to c:\test\test1.dbf // and we don't want the function to fail if the file TEST1.DBF exists CopyFile("c:\\TEST\\test.dbf", "c:\\TEST\\test1.dbf", FALSE); // Close handle to file FindClose(hSearch); } return 0; }The stdafx.h contains:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> // C RunTime Header Files #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h>This is a modified code from MSDN library.