// movetest.cpp // compile with: CL /W3 /MD movetest.cpp // example run: movetest fromfile tofile #include #include int main(int argc, char* argv[]) { if (argc != 3) { fprintf(stderr, "usage: movetest file1 file2\n"); return 1; } char* from = argv[1]; char* to = argv[2]; fprintf(stderr, "move '%s' to '%s'...", from, to); if (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)) { fprintf(stderr, "failed: error=%lu\n", (unsigned long)GetLastError()); return 2; } fprintf(stderr, "done.\n"); return 0; }