查找是否在C ++中复制文件(在Windows中)?

时间:2013-07-10 10:52:56

标签: windows file-copying boost-filesystem file-attributes

我想知道是否正在复制给定文件。最初我想做fopen(_file),因为fopen在文件被复制时返回false。但是在某些应用程序中打开文件时这个想法失败了(例如:当在MS powerpoint中打开ppt时,fopen返回false)。我正在搜索文件的属性,该文件唯一地标识文件是否被复制。即使在boost :: filesystem中我也找不到这样的属性。使用Boost lib可以解决这个问题吗?有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

boost filesystem fstream实用程序解决了这个问题

            boost::filesystem::fstream fileStream(filePath, std::ios_base::in | std::ios_base::binary);


            if(fileStream.is_open())
            {
                //not getting copied

            }
            else
            {
                //getting copied
            }
相关问题