MoveFile (kernel32.h)

MoveFile

The MoveFile function moves a file or directory from one location to another.

Prototype


        WIN32_WINUNIX.MoveFileW(
            L"",
            NULL
        );
        

Description

This function is a Windows API function that allows you to rename a file or directory. It's essentially a wrapper around the RenamedFile function in kernel32.dll.

Parameters

Return Value

The function returns TRUE on success and FALSE on failure.

Error Codes

Example


        #include 

        int main() {
            // Example usage (simplified)
            wchar_t filePath[] = L"C:\\MyFolder\\MyFile.txt";
            if (MoveFileW(filePath, NULL) == FALSE) {
                // Handle error
                DWORD error = GetLastError();
                // Further error handling...
            }
            return 0;
        }
        

See Also