سؤال

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top