FACT++  1.0
bool DataLogger::OpenStreamImp ( ofstream &  stream,
const string &  filename,
bool  mightbeopen 
)
private

Definition at line 741 of file datalogger.cc.

References Error(), and str.

742 {
743  if (stream.is_open())
744  {
745  if (!mightbeopen)
746  Error(filename+" was already open when trying to open it.");
747  return mightbeopen;
748  }
749 
750  errno = 0;
751  stream.open(filename.c_str(), ios_base::out | ios_base::app);
752  if (!stream /*|| errno!=0*/)
753  {
754  ostringstream str;
755  str << "ofstream::open() failed for '" << filename << "': " << strerror(errno) << " [errno=" << errno << "]";
756  Error(str);
757  return false;
758  }
759 
760  if (!stream.is_open())
761  {
762  Error("File "+filename+" not open as it ought to be.");
763  return false;
764  }
765 
766  Info("Opened: "+filename);
767 
768  return true;
769 }
char str[80]
Definition: test_client.c:7
int Error(const std::string &str)
Definition: MessageImp.h:49
int Info(const std::string &str)
Definition: MessageImp.h:47

+ Here is the call graph for this function: