简体   繁体   English

使用带有空格的路径时出现boost :: filesystem :: file_size错误

[英]boost::filesystem::file_size error when using a path with whitespace

I'm asking boost::filesystem::file_size for a file with path "/tmp/test\\ file.txt" , and it reports no such file or directory when it is there. 我问boost::filesystem::file_size是否有一个路径为"/tmp/test\\ file.txt"文件,它在那里报告没有这样的文件或目录。

Error: fs::file_size("/tmp/test\ file.txt") reported boost::filesystem::file_size: No such file or directory
-rw-rw-r-- 1 rturrado users 12486 Mar 15 12:01 /tmp/test file.txt

Are there any considerations when using paths with escaped sequences in boost::filesystem? 在boost :: filesystem中使用带有转义序列的路径时是否有任何注意事项?

Closing this question, as I fixed the issue thanks to Mat and ymett comments. 关闭这个问题,因为我通过Mat和ymett评论解决了这个问题。

boost::filesystem::file_size("/tmp/test file.txt") works just fine. boost::filesystem::file_size("/tmp/test file.txt")工作正常。 You don't need any escaping. 你不需要任何转义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM