Click here to Skip to main content
12,623,744 members (28,626 online)

C / C++ / MFC

 
GeneralRe: AutoCompletion Popup Listbox control Pin
Diarrhio20-Jan-02 15:40
memberDiarrhio20-Jan-02 15:40 
GeneralRe: AutoCompletion Popup Listbox control Pin
gh20-Jan-02 18:42
membergh20-Jan-02 18:42 
GeneralTypedef problems Pin
Stephen Caldwell18-Jan-02 17:20
memberStephen Caldwell18-Jan-02 17:20 
GeneralRe: Typedef problems Pin
Michael Dunn18-Jan-02 17:36
memberMichael Dunn18-Jan-02 17:36 
GeneralRe: Typedef problems Pin
Stephen Caldwell18-Jan-02 17:44
memberStephen Caldwell18-Jan-02 17:44 
GeneralRe: Typedef problems Pin
Michael Dunn18-Jan-02 17:43
memberMichael Dunn18-Jan-02 17:43 
GeneralRe: Typedef problems Pin
Nish [BusterBoy]18-Jan-02 17:54
memberNish [BusterBoy]18-Jan-02 17:54 
QuestionHow do I write my own stream? Pin
Xavier John18-Jan-02 17:10
memberXavier John18-Jan-02 17: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? Pin
Christian Graus18-Jan-02 23:51
memberChristian Graus18-Jan-02 23:51 
GeneralWould anyone give some ideas about DirectShow,thanks !! Pin
MrGao18-Jan-02 17:03
memberMrGao18-Jan-02 17:03 
GeneralEmbedding Word Automation in My App..But.. _Document.SaveAs... Pin
SoonWon18-Jan-02 16:15
memberSoonWon18-Jan-02 16:15 
GeneralActiveX scripting engine link error Pin
Neville Franks18-Jan-02 15:10
memberNeville Franks18-Jan-02 15:10 
GeneralAutomation problems using MFC Pin
Jean Louis18-Jan-02 12:37
memberJean Louis18-Jan-02 12:37 
GeneralRe: Automation problems using MFC Pin
moredip18-Jan-02 13:13
membermoredip18-Jan-02 13:13 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 13:19
memberJean Louis18-Jan-02 13:19 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 13:48
memberJean Louis18-Jan-02 13:48 
GeneralRe: Automation problems using MFC Pin
moredip18-Jan-02 13:55
membermoredip18-Jan-02 13:55 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 14:07
memberJean Louis18-Jan-02 14:07 
GeneralCArchive >> problems (why won't it take bools?) Pin
moredip18-Jan-02 12:26
membermoredip18-Jan-02 12:26 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
Michael Dunn18-Jan-02 14:09
memberMichael Dunn18-Jan-02 14:09 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
moredip18-Jan-02 14:16
membermoredip18-Jan-02 14:16 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
Michael Dunn18-Jan-02 14:34
memberMichael Dunn18-Jan-02 14:34 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
moredip21-Jan-02 6:41
membermoredip21-Jan-02 6:41 
GeneralXmlToArray Pin
Chris Zangarine18-Jan-02 10:57
memberChris Zangarine18-Jan-02 10:57 
GeneralNetwork monitor Pin
Mark Nischalke18-Jan-02 10:51
memberMark Nischalke18-Jan-02 10:51 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 2 Dec 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid