Можно ли использовать rdbuf()->in_avail(), чтобы проверить, были ли данные напечатаны в строковом потоке?C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Можно ли использовать rdbuf()->in_avail(), чтобы проверить, были ли данные напечатаны в строковом потоке?

Сообщение Anonymous »


In my code base there is code like the example below. A stringstream is used to collect output and later, if there have been things written to the stream these things are written to another stream. To check if there are things on the collecting stream the code uses rdbuf()->in_avail(). Is this well defined, and has the expected behavior changed between C++17 and C++20?

#include #include int main() { std::stringstream ss; ss.str(""); ss in_avail()) std::cout

Источник: https://stackoverflow.com/questions/781 ... ed-on-stri
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»