Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

printf vs cout

Name: Anonymous 2008-04-06 9:03

y halo that /prog/,
why does it seem that everyone uses printf and scanf instead of their counterparts cout and cin?

Name: Anonymous 2008-04-06 13:05

>>11
It has the same problem as scanf because you're raping it with a C-ism (statically-allocated string buffers). Replacing that with a string --

std::cout << "Have you read SICP today?\n>" << std::endl;
std::string response;
std::cin >> response;


fixes the buffer overflow problem.

That said, Sepple's stream-based approach to IO creates some really retarded semantics, especially with regards to formatting, whitespace consumption, etc. ``Stream Manipulators'' are really retarded.

Back to C, please.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List