Almost 4 years ago I shared a code snippet: CPrintStream - Polymorphic Printf. I recently came back to this code and decided to improve it in many ways. It is now more clean, efficient, and supports Unicode character set.
I created MISC repository on my GitHub for the purpose of such small code snippets and added new version of my code there, as:
A hierarchy of classes that represent abstract concept of a text-based stream that can be printed into, using methods like
print(const char* str),
printf(const char* format, ....) etc. Derived classes offer printing to console (standard output), to file, to memory buffer and more.