Fstream包含了ofstream和ifstream的所有内容
Fstream contain all the content of ofstream and ifstream?
如果两者都可以使用std::fstream
,为什么我们要使用std;:ofstream
作为输出,使用std::ifstream
作为输入?
这与stringstream、istingstream和ostingstream(链接)的情况类似。
通常,您不同时从同一个流中读取和写入,因此使用ifstream和ofstream更容易,因为您不必担心流状态和流位置(就像fstream的情况一样)。
相关文章:
- 如何导出包含具有"std::unique_ptr"值的"std::map"属性的
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 编译包含字符串的代码时遇到问题
- c++库的公共头文件中应该包含什么
- ifstream什么都没读
- 将包含C样式数组的对象初始化为成员变量(C++)
- 是否需要删除包含对象的"pair"?
- 函数何时会在c++中包含stack_Unwind_Resume调用
- 如何将包含epoch时间的十六进制字符串转换为time_t
- 使用mongocxx驱动程序时包含头文件问题
- 如何在h文件中包含.o对象文件
- 在混合代码库中将C转换为C++时出现许多包含错误
- VS2017,C++包含目录与附加包含目录,子文件夹包含失败-但为什么
- 如何重用包含 std::ifstream 的类
- Fstream包含了ofstream和ifstream的所有内容
- 当文件名包含宽字符时使用ifstream
- ifstream:跳过读取包含NaN的行
- 为什么包含fstream允许访问ofstream和ifstream ?
- 尝试编译包含二进制 ifstream 的代码时,编译会导致错误
- 在c++头文件中包含fstream或ifstream