小编Run*_*oid的帖子

Boost rename()函数不起作用

编译器在构建时没有抱怨,我的程序说它有效,并创建了文件夹,但文件没有移动.我究竟做错了什么?

#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)

c++ boost g++ codeblocks

2
推荐指数
2
解决办法
4690
查看次数

标签 统计

boost ×1

c++ ×1

codeblocks ×1

g++ ×1