ReactOS 0.4.15-dev-7907-g95bf896
movefile.c File Reference
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
Include dependency graph for movefile.c:

Go to the source code of this file.

Functions

int __cdecl _tmain (int argc, const TCHAR *argv[])
 

Function Documentation

◆ _tmain()

int __cdecl _tmain ( int  argc,
const TCHAR argv[] 
)

Definition at line 15 of file movefile.c.

16{
17 /* We need source + target */
18 if (argc < 3)
19 {
20 _ftprintf(stderr, _T("Missing arguments\nUsage: %s source target\nUse \"\" as target is you want deletion\n"), argv[0]);
21 return 1;
22 }
23
24 /* If target is empty, it means deletion, so provide null pointer */
25 if (!MoveFileEx(argv[1], (argv[2][0] == 0 ? NULL : argv[2]), MOVEFILE_DELAY_UNTIL_REBOOT))
26 {
27 _ftprintf(stderr, _T("Error: %d\n"), GetLastError());
28 return 1;
29 }
30
31 return 0;
32}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
#define stderr
Definition: stdio.h:100
#define _ftprintf
Definition: tchar.h:518
#define argv
Definition: mplay32.c:18
#define _T(x)
Definition: vfdio.h:22
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MoveFileEx
Definition: winbase.h:3878
#define MOVEFILE_DELAY_UNTIL_REBOOT
Definition: winbase.h:400