我正在做記錄,我希望有某種類似於流發生的事情的事情,最好做的,而不是CLogger << "Testing, " << 1 << ",2,3\n";
CLogger->log("Testing, %i,2,3", 1);
自定義流到C++的方法?
我的問題是我會怎麼做呢?我不想直接創建一個流到標準輸出,因爲我想使用我自己的方法,其中包括編寫文件等。我已經考慮用一個特定的結構重載,這會將當前的流緩衝區刷新到一個方法,但我必須做CLogger << flush << "Test!\n";
,這有點奇怪。
有誰知道如何做到這一點?
我澄清了我的第一篇文章,我也想格式化。 – Jookia 2010-12-06 13:48:55