#include #include //for ofstream #include #include #include "date.h" using namespace std; int main(int argc, char **argv) { const date d; cout << d << "\n"; //operator<<(cout, d).operator<<("\n"); ofstream ofstr("outfile"); if (!ofstr) { cerr << argv[0] << ": couldn't open outfile\n"; return EXIT_FAILURE; } ofstr << d << "\n"; //operator<<(ofstr, d).operator<<("\n"); if (!ofstr) { cerr << argv[0] << ": couldn't write to outfile\n"; return EXIT_FAILURE; } ostringstream os; os << d; //operator<<(os, d); if (!os) { cerr << argv[0] << ": couldn't write to string\n"; return EXIT_FAILURE; } cout << "The string contains \"" << os.str() << "\".\n"; return EXIT_SUCCESS; }