#include <File.hpp>
Redirection facility This function is used to redirect the output of the script to an auxiliary file This facility is used within the non-regression tests calling: std::stringstream sfn; sfn << gslBaseName(FILE) << ".out"; StdoutRedirect sr(sfn.str(), argc, argv); The redirection can be cancelled (with no argument modification) if the number of arguments 'argc' is larger than a given threshold By default, this threshold is set to 1 (name of executable itself) This can even be modified by adding 'number' different from 1 if some arguments are compulsory.
Public Member Functions | |
StdoutRedirect (const String &file="", int argc=0, char *argv[]=nullptr, int number=1) | |
~StdoutRedirect () | |
StdoutRedirect (const StdoutRedirect &)=delete | |
StdoutRedirect & | operator= (const StdoutRedirect &)=delete |
void | start (const String &file) |
void | stop () |
StdoutRedirect::StdoutRedirect | ( | const String & | file = "" , |
int | argc = 0 , |
||
char * | argv[] = nullptr , |
||
int | number = 1 |
||
) |
StdoutRedirect::~StdoutRedirect | ( | ) |
|
delete |
|
delete |
void StdoutRedirect::start | ( | const String & | file | ) |
Save current stdout handle and redirect std::cout to a file
[in] | file | File path to be written |
void StdoutRedirect::stop | ( | ) |
Restore original stdout