编译器在构建时没有抱怨,我的程序说它有效,并创建了文件夹,但文件没有移动.我究竟做错了什么?
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
char c = 'c';
bool move(){
if ((bool) rename("C:\\fldr1" "rawr.txt", "C:\\fldr2" "rared.txt") == (true)){
return true;
}
else{
return false;
}
}
int main(int argc, char argv[])
{
if (argv[1] = (c))
{
if (is_directory("C:\\fldr2")){
if (move){
cout << "Done 1!" << endl;
}
}
else{
cout << "Dir doesn't exist!" << endl;
if ((bool)create_directory("C:\\fldr2") == (true)){
if (move){
cout << "Done 2!" << endl;
}
}
}
} …Run Code Online (Sandbox Code Playgroud)