当前位置: 动力学知识库 > 问答 > 编程问答 >

Rename file on Windows 8 in C++

问题描述:

I am working on a Windows 8 machine running a C++ project. I sometimes receive a -1 response for the following line of code. Is there another way to rename a file that will work?

 std::rename(oldFileName, newFileName);

网友答案:

I wasn't able to receive output from perror but I was able to figure out the solution.

Last week there was a Windows updated (unknown to me because it was not my computer) that put more restrictions on the C drive. My oldFileName was located in the C drive and because of those restrictions, it would not rename the file. I had to move the file location out of the C drive.

分享给朋友:
您可能感兴趣的文章:
随机阅读: