C++/File/String Based IO


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

Perform both input and output

#include <iostream>
#include <strstream>
using namespace std;
int main()
{
  char iostr[80];
  strstream strio(iostr, sizeof(iostr), ios::in | ios::out);
  int a, b;
  char str[80];
  strio << "10 20 30 40 50 60 www.java2s.co testing ";
  strio >> a >> b >> str;
  cout << a << " " << b << " " << str << endl;
  return 0;
}