24 FILE *f=
os::fopen(fileName.c_str(), append ?
"at" :
"wt");
38 FILE *f=
os::fopen(fileName.c_str(),append ?
"at" :
"wt");
52 FILE *f=
os::fopen(fileName.c_str(),append ?
"at" :
"wt");
66 FILE *f=
os::fopen(fileName.c_str(),append ?
"at" :
"wt");
70 os::fprintf(f,byRows ?
"%u ":
"%u\n",static_cast<unsigned int>(*it));
80 FILE *f =
os::fopen( fileName.c_str(),
"r" );
87 size_t readed = fscanf( f, byRows ?
"%lf" :
"%lf\n", &number );
88 if ( (!byRows) || (readed == 1) )
89 vec.push_back( number );
113 catch(...) {
return false; }
125 of.
WriteBuffer( &vec[0],
sizeof(vec[0])*vec.size() );
128 catch(...) {
return false; }
size_t ReadBuffer(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer.
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::vector< uint8_t > vector_byte
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
bool BASE_IMPEXP vectorToBinaryFile(const vector_byte &vec, const std::string &fileName)
Saves a vector directly as a binary dump to a file:
const Scalar * const_iterator
This CStream derived class allow using a file as a write-only, binary stream.
GLsizei const GLchar ** string
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool BASE_IMPEXP vectorFromTextFile(std::vector< double > &vec, const std::string &fileName, const bool byRows=false)
Load a std::vector from a text file (compat.
bool BASE_IMPEXP vectorToTextFile(const std::vector< float > &vec, const std::string &fileName, bool append=false, bool byRows=false)
A useful function for debugging, which saves a std::vector into a text file (compat.
bool BASE_IMPEXP loadBinaryFile(vector_byte &out_data, const std::string &fileName)
Loads a entire file as a vector of bytes.