Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GenericLog.h
- #include <fstream>
- #include <string>
- class GenericLog
- {
- public:
- GenericLog( const std::string& filename = "log.txt" );
- template< typename T >
- GenericLog& operator << ( const T& t )
- {
- std::cout << t;
- file << t;
- return ( * this );
- }
- private:
- std::fstream file;
- };
- // GenericLog.cpp
- GenericLog::GenericLog( const std::string& filename )
- {
- // Create the file first :P
- file.open( filename, std::fstream::out | std::fstream::app );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement