linux报错:bash: syntax error near unexpected token `(‘ --路径中有括号怎么处理?

时间:2020-11-30 16:16:50   收藏:0   阅读:21

问题现象:执行命令时路径中带有括号符号“()”

技术图片

解决方法:

1.使用转义字符,在‘()’前加上\

dos2unix xiaoluo\(610603\)xiaoluo/1234.txt

2.在路径前后加上双引号

dos2unix "xiaoluo(610603)xiaoluo/1234.txt"

 在c++中用流打开时,必须使用第一种方法:

 
ifstream infile;
 
 
 
infile.open(strSourcePath, ios::in);
 
if (!infile.is_open()) {
 
     cout << "Failed to open file. " << strSourcePath;
 
            throw 1;
 
    }

 

此时,strSourcePath中的()前后必须加上\,否则文件打不开

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!