Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDevice context and dimensions Pin
Argonia1-Aug-13 4:54
professionalArgonia1-Aug-13 4:54 
QuestionHooking a running process 's Innermost dll's function Pin
dileep Perumbavoor1-Aug-13 1:26
dileep Perumbavoor1-Aug-13 1:26 
AnswerRe: Hooking a running process 's Innermost dll's function Pin
Erudite_Eric1-Aug-13 1:34
Erudite_Eric1-Aug-13 1:34 
AnswerRe: Hooking a running process 's Innermost dll's function Pin
pasztorpisti1-Aug-13 1:40
pasztorpisti1-Aug-13 1:40 
AnswerRe: Hooking a running process 's Innermost dll's function Pin
Santhosh G_3-Aug-13 23:30
Santhosh G_3-Aug-13 23:30 
QuestionSaving console output to .txt/.html file using C++/VC++ Pin
pk jain31-Jul-13 3:30
pk jain31-Jul-13 3:30 
AnswerRe: Saving console output to .txt/.html file using C++/VC++ Pin
Richard MacCutchan31-Jul-13 3:58
mveRichard MacCutchan31-Jul-13 3:58 
AnswerRe: Saving console output to .txt/.html file using C++/VC++ Pin
pasztorpisti31-Jul-13 4:25
pasztorpisti31-Jul-13 4:25 
You can solve this in two different ways: Inside your program or outside your program. The "outside" solution is probably simpler and more roboust and easier to implement.

Outside:
When you are running your program you redirect its output to another program that does the following: prints the incoming data to the console but at the same time it writes it into a text file and of course at the same time it can do other things too with the log data. You can do the redirection either by writing another program that runs the test with redirected input/output or you can choose an easier solution, piping together programs with the help of your cmd or bash:
Example python script that prints the input to console and logs to file at the same time:
file: x.py
import sys
with open('logfile.txt', 'w') as log_file:
    while 1:
        s = sys.stdin.readline()
        if not s:
            break
        sys.stdout.write(s)
        log_file.write(s)
        log_file.flush()

Commandline usage:
C++
TestProgram | python x.py

Of course this program could be anything, not only a python script but a perl script or a c/C++ program or a java program.

Inside:
If you want to solve the problem inside your test program then create your own logger and log through that instead of using printf() or similar methods. In your logger you can create many outputs so when your test program logs something your logger can direct it towards different outputs for example a console writer output, a html writer output and a text file writer output.

Almost forgot to mention: If you are on linux or you have cygwin on windows then you can use the tee command that does basically the same as the above python script.

modified 31-Jul-13 12:13pm.

QuestionCString to float conversion Pin
tagopi31-Jul-13 0:32
tagopi31-Jul-13 0:32 
AnswerRe: CString to float conversion Pin
pasztorpisti31-Jul-13 0:49
pasztorpisti31-Jul-13 0:49 
QuestionCan we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 0:26
002comp31-Jul-13 0:26 
AnswerRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 0:38
pasztorpisti31-Jul-13 0:38 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 1:34
002comp31-Jul-13 1:34 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 1:50
pasztorpisti31-Jul-13 1:50 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 2:23
002comp31-Jul-13 2:23 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 4:03
pasztorpisti31-Jul-13 4:03 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 18:11
002comp31-Jul-13 18:11 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 22:37
pasztorpisti31-Jul-13 22:37 
QuestionOrder of Overlapped Operations Pin
Richard Andrew x6430-Jul-13 21:58
professionalRichard Andrew x6430-Jul-13 21:58 
AnswerRe: Order of Overlapped Operations Pin
Randor 30-Jul-13 22:52
professional Randor 30-Jul-13 22:52 
GeneralRe: Order of Overlapped Operations Pin
Richard Andrew x6430-Jul-13 23:01
professionalRichard Andrew x6430-Jul-13 23:01 
AnswerRe: Order of Overlapped Operations Pin
pasztorpisti30-Jul-13 23:35
pasztorpisti30-Jul-13 23:35 
GeneralRe: Order of Overlapped Operations Pin
Richard Andrew x6431-Jul-13 7:14
professionalRichard Andrew x6431-Jul-13 7:14 
Questioncreating empty file Pin
sarfaraznawaz29-Jul-13 22:32
sarfaraznawaz29-Jul-13 22:32 
AnswerRe: creating empty file Pin
pasztorpisti29-Jul-13 22:37
pasztorpisti29-Jul-13 22:37 

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.