Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用广为人知的代码片段来复制文件:
std::ifstream src("in"); std::ofstream dest("out"); dest << src.rdbuf();
问题是:如何正确检查复制是否成功?
我认为检查 (src && dest) 的值是可以的,但是在源文件为空的情况下它会失败。