printf("%d: %d, %d\n", foo, bar, baz);
is much cleaner than
std::cout << foo << ": " << bar << ", " << baz << "\n";
and there is no obvious way at all to rewrite
scanf("%d: %d, %d\n", &foo, &bar, &baz);
other than, say
std::cin >> foo;
std::cin.ignore();
std::cin >> bar;
std::cin.ignore();
std::cin >> baz;
std::cin.ignore();
which is inferior for obvious reasons.
Why aren't there functions like istream::scanf
and ostream::printf
? I can't see any reason why the following shouldn't have been made possible:
std::cout.printf("%d: %d, %d\n", foo, bar, baz);
std::cin.scanf("%d: %d, %d\n", foo, bar, baz);
I'm sure someone must have proposed it for the standard at some point, and it must have been rejected. Why?