Click here to Skip to main content
       

C / C++ / MFC

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: AutoCompletion Popup Listbox controlmembergh20 Jan '02 - 17:42 
GeneralTypedef problemsmemberStephen Caldwell18 Jan '02 - 16:20 
GeneralRe: Typedef problemsmemberMichael Dunn18 Jan '02 - 16:36 
GeneralRe: Typedef problemsmemberStephen Caldwell18 Jan '02 - 16:44 
GeneralRe: Typedef problemsmemberMichael Dunn18 Jan '02 - 16:43 
GeneralRe: Typedef problemsmemberNish [BusterBoy]18 Jan '02 - 16:54 
QuestionHow do I write my own stream?memberXavier John18 Jan '02 - 16:10 
How can I write my own stream?
I need to write a stream class and redirect cerr to it. Based on the class settings I will log it to a file or a database.
 
I need to use the class like below
#include <iostream>
#include <fstream>
int main()
{
      std::ofstream logFile("out.txt");
      std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
      std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
 
      // do the actual work of the program;
      // GUI code and event loop would go here
      std::cout << "This would normally go to cout but goes to the log file\n";
      std::cerr << "This would normally go to cerr but goes to the log file \n";
      logFile << "This goes to the log file\n";
      // end of program body
 
      // restore the buffers
      std::cout.rdbuf(outbuf);
      std::cerr.rdbuf(errbuf);
}
 
But my class will log to the disk or log to a DBMS.
 
Regards,
Xavier

AnswerRe: How do I write my own stream?memberChristian Graus18 Jan '02 - 22:51 
GeneralWould anyone give some ideas about DirectShow,thanks !!memberMrGao18 Jan '02 - 16:03 
GeneralEmbedding Word Automation in My App..But.. _Document.SaveAs...memberSoonWon18 Jan '02 - 15:15 
GeneralActiveX scripting engine link errormemberNeville Franks18 Jan '02 - 14:10 
GeneralAutomation problems using MFCmemberJean Louis18 Jan '02 - 11:37 
GeneralRe: Automation problems using MFCmembermoredip18 Jan '02 - 12:13 
GeneralRe: Automation problems using MFCmemberJean Louis18 Jan '02 - 12:19 
GeneralRe: Automation problems using MFCmemberJean Louis18 Jan '02 - 12:48 
GeneralRe: Automation problems using MFCmembermoredip18 Jan '02 - 12:55 
GeneralRe: Automation problems using MFCmemberJean Louis18 Jan '02 - 13:07 
GeneralCArchive >> problems (why won't it take bools?)membermoredip18 Jan '02 - 11:26 
GeneralRe: CArchive >> problems (why won't it take bools?)memberMichael Dunn18 Jan '02 - 13:09 
GeneralRe: CArchive >> problems (why won't it take bools?)membermoredip18 Jan '02 - 13:16 
GeneralRe: CArchive >> problems (why won't it take bools?)memberMichael Dunn18 Jan '02 - 13:34 
GeneralRe: CArchive >> problems (why won't it take bools?)membermoredip21 Jan '02 - 5:41 
GeneralXmlToArraymemberChris Zangarine18 Jan '02 - 9:57 
GeneralNetwork monitormemberMark Nischalke18 Jan '02 - 9:51 
GeneralRe: Network monitormemberJoaquín M López Muñoz18 Jan '02 - 10:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 19 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid