cin
reads from stdin
cout
writes to stdout
cerr
writes to strerr
string input;
cin >> input; cout << "Write to stdout";
cerr << "Write to stderr";
Is stdout and stderr used in c++?
Yes, like I said
cout
and
cerr
writes to those.
by using fprintf() or stuff like that by taking streams?
Ifyou want to use
fprintf
then you just pass the stream you want to write to as the first parameter:
#include <stdio.h>
fprintf(stdout, "Writing to stdout");
FILE* stdout, stderr, stdin
are defined in stdio.h