cxxtools::ArgOut Class Reference

Helper class for redirecting output to stdout or file using command line switch. More...

#include <cxxtools/argout.h>

Public Member Functions

 ArgOut (int &argc, char *argv[], char option)
 ArgOut (int &argc, char *argv[], const char *option)
 ArgOut (int &argc, char *argv[])
bool redirected () const

Detailed Description

Helper class for redirecting output to stdout or file using command line switch.

Using this class it is easy to provide a command line switch to the user to redirect output to a file.

Examples:

int main(int argc, char* argv[])
{
cxxtools::ArgOut out(argc, argv, 'o');
out << "this is printed to std::cout or to a file when a file name with the -o option is passed" << std::endl;
}
int main(int argc, char* argv[])
{
cxxtools::ArgOut out(argc, argv);
out << "this is printed to std::cout or to a file when a file name is passed as a parameter" << std::endl;
}

Constructor & Destructor Documentation

cxxtools::ArgOut::ArgOut ( int &  argc,
char *  argv[],
char  option 
)
inline
cxxtools::ArgOut::ArgOut ( int &  argc,
char *  argv[],
const char *  option 
)
inline
cxxtools::ArgOut::ArgOut ( int &  argc,
char *  argv[] 
)
inline

Member Function Documentation

bool cxxtools::ArgOut::redirected ( ) const
inline

The documentation for this class was generated from the following file: