什么是fstream对象?输出文件而不是实际文件流的对象,还是代表文件流?

发布于 2025-02-04 13:18:41 字数 162 浏览 3 评论 0原文

FSTREAM代表所有输入和输出文件流,对吗?当我创建一个ofstream对象时,我是在创建一个可以用来输出到文件的对象(实际上不代表文件流)还是我在创建文件流?当我调用函数std :: ofStream :: Open时,它会创建从ofstream对象到我指定的文件的流来源吗?

fstream represents all the input and output file streams right? When I create an ofstream object, am I creating an object that can be used to output to files (doesn't actually represent the file stream) or am I creating a file stream? When I call the function std::ofstream::open, it creates the stream from the ofstream object to the file I specify right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

话少情深 2025-02-11 13:18:41

“文件流”是一个概念。创建一个std :: Ofstream的对象时,可以创建一个“流”,但它并不是立即与文件相关的。您可以在创建时“关联”它(通过将文件指定为构造函数参数),也可以使用std :: ofStream :: Open使用单独的操作。

"File stream" is a concept. You create a "stream" when you create an object of std::ofstream but it's not neccessarily associated with a file straight away. You can "associate" it either upon creation (by specifying the file as a constructor argument) or as a separate operation with use of std::ofstream::open

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文