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.
和
fstream file("test.txt",ios_base::in | ios_base::out | ios_base::binary);
是tellp和tellg相同的file?或者seekp和seekg?
tellp
tellg
file
seekp
seekg
是的,std::filebuf使用的缓冲区std::fstream只有一个指针。seekg并seekp移动相同的指针,tellg并tellp返回其位置。
std::filebuf
std::fstream
(指针不同的流示例是std::stringstream)
std::stringstream
该标准在§27.9.1.1[filebuf]/3
§27.9.1.1[filebuf]/3
为输入序列和输出序列维护一个联合文件位置