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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -