Output in Log file instead of Standard Input Output
I am developing C++ application.As size of the code increases, I feel my printf output needs to go to some file instead of stdio.
Is there is any standard class or I need to write code from scratch? |
If it is about error/debug-messages, they could be sent to stderr (cf: fprintf), to separate them from the normal output. stderr can be redirected from shell:
Code:
./myexe 2>messages.log |
Or... if you simply want to write to a FILE instead of to stdout,
Code:
#include <fstream> Code:
#include <iostream> Code:
./file_write Code:
cat cpp.log Best regards, HMW PS. Haven't used c++ in AGES. Please be gentle! DS. |
Thanks.I want similar to what HMW has written.
|
All times are GMT -5. The time now is 10:01 AM. |