C++中的流同步
Stream synchronization in c++
我最近考了C++。它已经完成了,但我只知道我的分数,不知道正确答案。有两个问题:
1.可以使用标准函数同步 C++ 流吗? (是或否)
2。可以使用标准函数将 C++ 流与 stdio input/output 同步吗? (是或否)
我不知道第一个问题的答案。第二个问题的答案是肯定的,因为我们有函数ios_base::sync_with_stdio()
.
test没有上下文,是'general c++ knowledge test'。所以我无法猜测上下文。虽然它是关于 C++03 标准的,但我认为多线程同步已经过时了。
正确答案是什么?
谢谢。
- Can C++ streams be synchronized using functions from standard? (yes or no)
是的,他们可以使用 tie()。绑定流是一个输出流对象,在该流对象中的每个 I/O 操作之前被刷新。
- Can C++ stream be synchronized with stdio input/output using functions from standard? (yes or no)
c++20增加了输出流同步的新功能:
https://en.cppreference.com/w/cpp/io/basic_osyncstream
我最近考了C++。它已经完成了,但我只知道我的分数,不知道正确答案。有两个问题:
1.可以使用标准函数同步 C++ 流吗? (是或否)
2。可以使用标准函数将 C++ 流与 stdio input/output 同步吗? (是或否)
我不知道第一个问题的答案。第二个问题的答案是肯定的,因为我们有函数ios_base::sync_with_stdio()
.
test没有上下文,是'general c++ knowledge test'。所以我无法猜测上下文。虽然它是关于 C++03 标准的,但我认为多线程同步已经过时了。
正确答案是什么? 谢谢。
- Can C++ streams be synchronized using functions from standard? (yes or no)
是的,他们可以使用 tie()。绑定流是一个输出流对象,在该流对象中的每个 I/O 操作之前被刷新。
- Can C++ stream be synchronized with stdio input/output using functions from standard? (yes or no)
c++20增加了输出流同步的新功能: https://en.cppreference.com/w/cpp/io/basic_osyncstream