utils_io.h Source File

LibRPA: utils_io.h Source File
LibRPA
utils_io.h
1 #pragma once
2 
3 #include "envs_io.h"
4 
5 namespace LIBRPA
6 {
7 
8 namespace utils
9 {
10 
12 template <typename... Args>
13 void lib_printf(const char* format, Args&&... args)
14 {
16  (fprintf(envs::pfile_redirect, format, std::forward<Args>(args)...), fflush(envs::pfile_redirect)):
17  printf(format, std::forward<Args>(args)...);
18 }
19 
20 } /* end of name space utils */
21 
22 } /* end of name space LIBRPA */
bool redirect_stdout
Control whether to redirect stdout (cout, fmt print) to file.
Definition: envs_io.cpp:18
FILE * pfile_redirect
File stream used by fprintf when stdout is redirected.
Definition: envs_io.cpp:19
void lib_printf(const char *format, Args &&... args)
printf that handles the stdout redirect
Definition: utils_io.h:13
Definition: analycont.cpp:14