14 # define _SCL_SECURE_NO_WARNINGS 28 const string &fileName,
29 bool append ) : m_of()
33 if (!
open(fileName,append))
50 const string &fileName,
56 ios_base::openmode openMode = ios_base::binary | ios_base::out;
58 openMode |= ios_base::app;
60 m_of.open(fileName.c_str(), openMode );
61 return m_of.is_open();
98 if (!
m_of.is_open())
return 0;
100 m_of.write( static_cast<const char*>(Buffer),Count);
101 return m_of.fail() ? 0:Count;
111 if (!
m_of.is_open())
return 0;
113 ofstream::off_type
offset = Offset;
114 ofstream::seekdir way;
156 return m_of.is_open();
bool fileOpenCorrectly()
Returns true if the file was open without errors.
void close()
Close the stream.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
TSeekOrigin
Used in CStream::Seek.
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
bool open(const std::string &fileName, bool append=false)
Open the given file for write.
std::ofstream m_of
The actual output file stream.
uint64_t getTotalBytesCount() MRPT_OVERRIDE
Method for getting the total number of bytes writen to buffer.
size_t Read(void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for reading from the stream.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
uint64_t getPosition() MRPT_OVERRIDE
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
size_t Write(const void *Buffer, size_t Count) MRPT_OVERRIDE
Introduces a pure virtual method responsible for writing to the stream.
unsigned __int64 uint64_t
CFileOutputStream()
Default constructor.
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
Introduces a pure virtual method for moving to a specified position in the streamed resource...
virtual ~CFileOutputStream()
Destructor.