On Windows is there an interface for Copying Folders?

前端 未结 7 646
陌清茗
陌清茗 2021-01-18 06:41

I want to copy folder A and paste to desktop.

I am currently using C++ so preferably an OO interface if available.

7条回答
  •  情深已故
    2021-01-18 07:16

    For a platform agnostic solution, I'd suggest Boost::filesystem. That link is basically the reference material. There is a copy_file method that copies a file from one location to another.

    On Windows, the desktop is a special folder:

    // String buffer for holding the path.
    TCHAR strPath[ MAX_PATH ];
    
    // Get the special folder path.
    SHGetSpecialFolderPath(
        0,       // Hwnd
        strPath, // String buffer.
        CSIDL_DESKTOPDIRECTORY, // CSLID of folder
        FALSE ); // Create if doesn't exists?
    

提交回复
热议问题