我读了istream::get并且怀疑仍然存在。假设我的分隔符实际上是 NULL '\0' 字符,在这种情况下会发生什么?从我读到的:
If the delimiting character is found, it is not extracted from the input sequence and remains as the next character to be extracted. Use getline if you want this character to be extracted (and discarded). The ending null character that signals the end of a c-string is automatically appended at the end of the content stored in s.
我更喜欢“get”而不是“readline”的原因是能够将字符流提取到“streambuf”中。