Redirecting ESP Log output to file and back to USB serial
Posted: Sun Jan 15, 2023 5:47 pm
I am building a system that will have no USB serial connection most of the time and I want to re-direct stdout to a file on an SD card to store all of the logging messages. I am using:
to redirect stdout. Works great. Now at some point a USB connection may become available and I want to redirect stdout back to the USB serial port. What is the proper filename and mode to put into
?
Thanks so much!
Code: Select all
freopen(FileMonitorLog, "a", stdout);
Code: Select all
FILE *freopen(const char *filename, const char *mode, FILE *stream)
Thanks so much!