Go to the documentation of this file.
20 const vector<float>& vec,
const string& fileName,
bool append,
bool byRows)
22 FILE* f =
os::fopen(fileName.c_str(), append ?
"at" :
"wt");
35 const vector<double>& vec,
const string& fileName,
bool append,
bool byRows)
37 FILE* f =
os::fopen(fileName.c_str(), append ?
"at" :
"wt");
50 const vector<int>& vec,
const string& fileName,
bool append,
bool byRows)
52 FILE* f =
os::fopen(fileName.c_str(), append ?
"at" :
"wt");
65 const vector<size_t>& vec,
const string& fileName,
bool append,
bool byRows)
67 FILE* f =
os::fopen(fileName.c_str(), append ?
"at" :
"wt");
71 os::fprintf(f, byRows ?
"%u " :
"%u\n",
static_cast<unsigned int>(*it));
80 std::vector<double>& vec,
const std::string& fileName,
bool byRows)
82 FILE* f =
os::fopen(fileName.c_str(),
"r");
89 size_t readed = fscanf(f, byRows ?
"%lf" :
"%lf\n", &number);
90 if ((!byRows) || (readed == 1)) vec.push_back(number);
const Scalar * const_iterator
int void fclose(FILE *f)
An OS-independent version of fclose.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool vectorFromTextFile(std::vector< double > &vec, const std::string &fileName, const bool byRows=false)
Load a std::vector from a text file (compat.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
GLsizei const GLchar ** string
bool 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.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at mié 12 jul 2023 10:03:34 CEST | |