13 #define _SCL_SECURE_NO_WARNINGS 31 if (!
open(fileName, append))
33 "Error creating/opening for write file: '%s'", fileName.c_str());
50 ios_base::openmode openMode = ios_base::binary | ios_base::out;
51 if (append) openMode |= ios_base::app;
53 m_of.open(fileName.c_str(), openMode);
54 return m_of.is_open();
87 if (!
m_of.is_open())
return 0;
89 m_of.write(static_cast<const char*>(Buffer), Count);
90 return m_of.fail() ? 0 : Count;
100 if (!
m_of.is_open())
return 0;
102 ofstream::off_type
offset = Offset;
103 ofstream::seekdir way;
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream.
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.
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
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 getPosition() override
Method for getting the current cursor position, where 0 is the first byte and TotalBytesCount-1 the l...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
unsigned __int64 uint64_t
CFileOutputStream()
Default constructor.
virtual ~CFileOutputStream()
Destructor.
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
uint64_t getTotalBytesCount() override
Method for getting the total number of bytes writen to buffer.