c++ - print time on each call to std::cout -
how that? example like:
std::cout << "something";
then should print time before "something"
you use simple function prints timestamp , returns stream further printing:
std::ostream& tcout() { // todo: timestamp in desired format return std::cout << timestamp << ": "; }
you call function instead of using std::cout
directly, whenever want timestamp inserted:
tcout() << "hello" << std::endl;
Comments
Post a Comment