Main MRPT website > C++ reference for MRPT 1.5.9
os.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "base-precomp.h" // Precompiled headers
11 
12 #include <mrpt/system/os.h>
13 #include <mrpt/system/filesystem.h>
14 
15 #ifndef HAVE_TIMEGM
17 #endif // HAVE_TIMEGM
18 
19 #include <cstring>
20 #include <float.h>
21 #include <iostream>
22 #include <algorithm>
23 #include <cctype>
24 #include <ctime>
25 #include <cstdio>
26 
27 #ifdef MRPT_OS_WINDOWS
28  #include <conio.h>
29  #include <windows.h>
30  #include <tlhelp32.h>
31  #include <sys/utime.h>
32  #include <io.h>
33  #include <direct.h>
34 #else
35  #include <pthread.h>
36  #include <termios.h>
37  #include <poll.h>
38  #include <unistd.h>
39  #include <sys/select.h>
40  #include <sys/time.h>
41  #include <time.h>
42  #include <unistd.h>
43  #include <utime.h>
44  #include <errno.h>
45 // #include <signal.h>
46 #endif
47 
48 #include <sys/types.h>
49 #include <sys/stat.h>
50 
51 #ifdef MRPT_OS_LINUX
52  #define _access access
53  #define _rmdir rmdir
54  #define _stat stat
55 #endif
56 
57 #include <sstream>
58 
59 using namespace mrpt;
60 using namespace mrpt::utils;
61 using namespace mrpt::system;
62 using namespace std;
63 
64 #ifndef MRPT_OS_WINDOWS
65  /** By ninjalj in http://stackoverflow.com/questions/3962263/checking-if-a-key-was-pressed
66  */
67  void my_aux_sighandler(int) {}
68 
69  int myKbhit(void)
70  {
71  struct termios oldtio, curtio;
72 // struct sigaction sa;
73 
74  /* Save stdin terminal attributes */
75  tcgetattr(0, &oldtio);
76 
77 // memset(&sa, 0, sizeof(struct sigaction));
78 
79  /* Set non-canonical no-echo for stdin */
80  tcgetattr(0, &curtio);
81  curtio.c_lflag &= ~(ICANON | ECHO);
82  tcsetattr(0, TCSANOW, &curtio);
83 
84  struct pollfd pfds[1];
85 
86  /* See if there is data available */
87  pfds[0].fd = 0;
88  pfds[0].events = POLLIN;
89  const int ret = poll(pfds, 1, 0);
90 
91  /* restore terminal attributes */
92  tcsetattr(0, TCSANOW, &oldtio);
93 
94  return (ret > 0);
95  }
96 
97 #endif
98 
99 /*---------------------------------------------------------------
100  timegm
101  ---------------------------------------------------------------*/
102 #ifdef HAVE_TIMEGM
103  time_t mrpt::system::os::timegm(struct tm *tm)
104  {
105  return ::timegm(tm);
106  }
107 #else
108  // Version for MSVC>=2005, which lacks "timegm"
109  #ifdef HAVE_MKGMTIME
110  time_t mrpt::system::os::timegm(struct tm *tm)
111  {
112  return ::_mkgmtime(tm);
113  }
114  #else
115  // generic version, slower but probably not used in any modern compiler!
116  time_t mrpt::system::os::timegm(struct tm *tm)
117  {
120 
121  time_t ret;
122  char tz[256];
123 
124  /* save current timezone and set UTC */
125  char *org_tz = getenv("TZ");
126  if (org_tz) os::strcpy(tz,sizeof(tz),org_tz);
127 
128  putenv("TZ=UTC"); /* use Coordinated Universal Time (i.e. zero offset) */
129  tzset();
130 
131  ret = mktime(tm);
132  if(org_tz)
133  {
134  char buf[256];
135  mrpt::system::os::sprintf(buf, sizeof(buf), "TZ=%s", tz);
136  putenv(buf);
137  } else
138  putenv("TZ=");
139  tzset();
140 
141  return ret;
142  }
143 
144  #endif
145 #endif // HAVE_TIMEGM
146 
147 /*---------------------------------------------------------------
148  mrpt::system::MRPT_getCompilationDate
149 ---------------------------------------------------------------*/
150 #include <mrpt/version.h>
151 #include <errno.h>
152 #include <limits>
153 #include <climits>
154 #include <ctime>
155 #include <cstdlib>
156 
158 {
159  time_t now;
160  char *endptr;
161  const char *source_date_epoch = MRPT_SOURCE_DATE_EPOCH;
162 
163  errno = 0;
164  unsigned long epoch = strtoul(source_date_epoch, &endptr, 10);
165  if (epoch==0 || ((errno == ERANGE && (epoch == std::numeric_limits<unsigned long>::max() || epoch == 0)) || (errno != 0 && epoch == 0))) {
166  // Last resort:
167  now = time(NULL);
168  }
169  else {
170  now = epoch;
171  }
172  struct tm *build_time = gmtime(&now);
173  const int year = build_time->tm_year + 1900;
174  const int month = build_time->tm_mon + 1;
175  const int day = build_time->tm_mday;
176 
177  return mrpt::format("%i-%02i-%02i %02i:%02i:%02i UTC",year,month,day, build_time->tm_hour,build_time->tm_min, build_time->tm_sec);
178 }
179 
180 /*---------------------------------------------------------------
181  mrpt::system::MRPT_getVersion
182 ---------------------------------------------------------------*/
184 {
185  return string(::MRPT_version_str);
186 }
187 
188 /*---------------------------------------------------------------
189  sprintf
190 ---------------------------------------------------------------*/
191 int os::sprintf(char *buf, size_t bufSize, const char *format, ...) MRPT_NO_THROWS
192 {
194 
195  int result;
196  va_list ap;
197  va_start (ap, format);
198 
199 #if defined(_MSC_VER) && (_MSC_VER>=1400)
200  // Use a secure version in Visual Studio 2005:
201  result = ::vsprintf_s (buf, bufSize, format, ap);
202 #else
203  // Use standard version:
204  result = ::vsprintf (buf, format, ap);
205 #endif
206 
207  va_end (ap);
208  return result;
209 }
210 
211 /*---------------------------------------------------------------
212  vsprintf
213 ---------------------------------------------------------------*/
214 int os::vsprintf(char *buf, size_t bufSize, const char *format, va_list args) MRPT_NO_THROWS
215 {
217 #if defined(_MSC_VER) && (_MSC_VER>=1400)
218  // Use a secure version in Visual Studio 2005:
219  return ::vsprintf_s (buf, bufSize, format, args);
220 #else
221  // Use standard version:
222  return ::vsprintf (buf, format, args);
223 #endif
224 }
225 
226 /*---------------------------------------------------------------
227  vsnprintf
228 ---------------------------------------------------------------*/
229 int os::vsnprintf(char *buf, size_t bufSize, const char *format, va_list args) MRPT_NO_THROWS
230 {
231 #if defined(_MSC_VER)
232  #if (_MSC_VER>=1400)
233  // Use a secure version in Visual Studio 2005:
234  return ::vsnprintf_s (buf, bufSize, _TRUNCATE, format, args);
235  #else
236  return ::vsprintf(buf,format, args);
237  #endif
238 #else
239  // Use standard version:
240  return ::vsnprintf(buf, bufSize,format, args);
241 #endif
242 }
243 
244 /*---------------------------------------------------------------
245  fopen
246 ---------------------------------------------------------------*/
247 FILE * os::fopen(const std::string &fileName,const char *mode) MRPT_NO_THROWS
248 {
249  return fopen(fileName.c_str(),mode);
250 }
251 
252 /*---------------------------------------------------------------
253  fopen
254 ---------------------------------------------------------------*/
255 FILE * os::fopen(const char *fileName,const char *mode) MRPT_NO_THROWS
256 {
257 #if defined(_MSC_VER) && (_MSC_VER>=1400)
258  // Use a secure version in Visual Studio 2005:
259  FILE *f;
260  if (0 != ::fopen_s(&f,fileName,mode))
261  return NULL;
262  else return f;
263 #else
264  // Use standard version:
265  return ::fopen(fileName,mode);
266 #endif
267 }
268 
269 /*---------------------------------------------------------------
270  fclose
271 ---------------------------------------------------------------*/
272 void os::fclose(FILE *f)
273 {
274  if (!f) THROW_EXCEPTION("Trying to close a NULL 'FILE*' descriptor")
275  ::fclose(f);
276 }
277 
278 /*---------------------------------------------------------------
279  strcat
280 ---------------------------------------------------------------*/
281 char * os::strcat(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
282 {
283  MRPT_UNUSED_PARAM(destSize);
284 
285 #if defined(_MSC_VER) && (_MSC_VER>=1400)
286  ::strcat_s(dest,destSize,source);
287 #else
288  ::strcat(dest,source);
289 #endif
290  return dest;
291 }
292 
293 /*---------------------------------------------------------------
294  strcpy
295 ---------------------------------------------------------------*/
296 char * os::strcpy(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
297 {
298  MRPT_UNUSED_PARAM(destSize);
299 
300 #if defined(_MSC_VER) && (_MSC_VER>=1400)
301  ::strcpy_s(dest,destSize,source);
302 #else
303  ::strcpy(dest,source);
304 #endif
305  return dest;
306 }
307 
308 
309 /*---------------------------------------------------------------
310  strcmp
311 ---------------------------------------------------------------*/
312 int os::_strcmp(const char*str1,const char*str2) MRPT_NO_THROWS
313 {
314  return ::strcmp(str1,str2);
315 }
316 
317 /*---------------------------------------------------------------
318  strcmpi
319 ---------------------------------------------------------------*/
320 int os::_strcmpi(const char*str1,const char*str2) MRPT_NO_THROWS
321 {
322 #ifdef MRPT_OS_WINDOWS
323  #if defined(_MSC_VER) && (_MSC_VER>=1400)
324  return ::_strcmpi(str1,str2);
325  #else
326  return ::strcmpi(str1,str2);
327  #endif
328 #else
329  return ::strcasecmp(str1,str2);
330 #endif
331 }
332 
333 /** An OS-independent version of strncmp.
334 * \return It will return 0 when both strings are equal, casi sensitive.
335 */
336 int os::_strncmp(const char*str1,const char*str2,size_t count) MRPT_NO_THROWS
337 {
338  return ::strncmp(str1,str2,count);
339 }
340 
341 /** An OS-independent version of strnicmp.
342 * \return It will return 0 when both strings are equal, casi insensitive.
343 */
344 int os::_strnicmp(const char*str1,const char*str2,size_t count) MRPT_NO_THROWS
345 {
346 #if defined(_MSC_VER)
347  return ::_strnicmp(str1,str2,count);
348 #else
349  return ::strncasecmp(str1,str2,count);
350 #endif
351 }
352 
353 
354 
355 /*---------------------------------------------------------------
356  memcpy
357 ---------------------------------------------------------------*/
359  void *dest,
360  size_t destSize,
361  const void *src,
362  size_t copyCount) MRPT_NO_THROWS
363 {
364 #if defined(_MSC_VER) && (_MSC_VER>=1400)
365  ::memcpy_s(dest,destSize,src,copyCount);
366 #else
367  MRPT_UNUSED_PARAM(destSize);
368  ::memcpy(dest,src,copyCount);
369 #endif
370 }
371 
372 /*---------------------------------------------------------------
373  getch
374 ---------------------------------------------------------------*/
376 {
377 #ifdef MRPT_OS_WINDOWS
378  return ::getch(); // cin.get();
379 #else
380  struct termios oldt,
381  newt;
382  int ch;
383  tcgetattr(STDIN_FILENO, &oldt);
384  newt = oldt;
385  newt.c_lflag &= ~(ICANON | ECHO);
386  tcsetattr(STDIN_FILENO, TCSANOW, &newt);
387  ch = getchar();
388  tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
389  return ch;
390 #endif
391 }
392 
393 /*---------------------------------------------------------------
394  kbhit
395 ---------------------------------------------------------------*/
397 {
398 #ifdef MRPT_OS_WINDOWS
399  #if defined(_MSC_VER) && (_MSC_VER>=1400)
400  return ::_kbhit() != 0;
401  #else
402  return ::kbhit() != 0;
403  #endif
404 #else
405  return myKbhit();
406 #endif
407 }
408 
409 /*---------------------------------------------------------------
410  os::fprintf
411 ---------------------------------------------------------------*/
412 int os::fprintf(FILE *fil, const char *frm, ...) MRPT_NO_THROWS
413 {
414  int result;
415  va_list ap;
416  va_start(ap, frm);
417 
418 #if defined(_MSC_VER) && (_MSC_VER>=1400)
419  // Use a secure version in Visual Studio 2005:
420  result = ::vfprintf_s(fil, frm, ap);
421 
422 #else
423  // Use standard version:
424  result = ::vfprintf(fil, frm, ap);
425 #endif
426 
427  va_end (ap);
428  return result;
429 }
430 
431 
432 /*---------------------------------------------------------------
433  mrpt::system::pause
434 ---------------------------------------------------------------*/
436 {
437  std::cout << msg << std::endl;
438  os::getch();
439 }
440 
441 /*---------------------------------------------------------------
442  clearConsole
443 ---------------------------------------------------------------*/
445 {
446 #ifdef MRPT_OS_WINDOWS
447  int ret=::system("cls");
448 #else
449  int ret=::system("clear");
450 #endif
451  if (ret)
452  cerr << "[mrpt::system::clearConsole] Error invoking 'clear screen' " << endl;
453 }
454 
455 
456 /*---------------------------------------------------------------
457  _strtoll
458  ---------------------------------------------------------------*/
459 int64_t mrpt::system::os::_strtoll(const char *nptr, char **endptr, int base)
460 {
461 #ifdef MRPT_OS_WINDOWS
462  return (int64_t) ::strtol(nptr, endptr, base);
463 #else
464  return (int64_t) ::strtoll(nptr, endptr, base);
465 #endif
466 
467 }
468 
469 /*---------------------------------------------------------------
470  _strtoull
471  ---------------------------------------------------------------*/
472 uint64_t mrpt::system::os::_strtoull(const char *nptr, char **endptr, int base)
473 {
474 #ifdef MRPT_OS_WINDOWS
475  return (uint64_t) ::strtoul(nptr, endptr, base);
476 #else
477  return (uint64_t) ::strtoull(nptr, endptr, base);
478 #endif
479 
480 }
481 
482 /** Changes the text color in the console for the text written from now on.
483  * The parameter "color" can be:
484  * - 0 : Normal text color
485  * - 1 : Blue text color
486  * - 2 : Green text color
487  * - 4 : Red text color
488  */
490 {
491  static const int TS_NORMAL = 0;
492  static const int TS_BLUE = 1;
493  static const int TS_GREEN = 2;
494  static const int TS_RED = 4;
495 #ifdef MRPT_OS_WINDOWS
496  static int normal_attributes = -1;
497  HANDLE hstdout = GetStdHandle(changeStdErr ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE);
498  fflush(changeStdErr ? stderr: stdout);
499 
500  if(normal_attributes < 0)
501  {
502  CONSOLE_SCREEN_BUFFER_INFO info;
503  GetConsoleScreenBufferInfo(hstdout, &info);
504  normal_attributes = info.wAttributes;
505  }
506 
507  SetConsoleTextAttribute(hstdout,
508  (WORD)(color == TS_NORMAL ? normal_attributes :
509  ((color & TS_BLUE ? FOREGROUND_BLUE : 0)|
510  (color & TS_GREEN ? FOREGROUND_GREEN : 0)|
511  (color & TS_RED ? FOREGROUND_RED : 0)|FOREGROUND_INTENSITY)));
512 #else
513  // *nix:
514  static TConsoleColor old_color = mrpt::system::CONCOL_NORMAL;
515  if (old_color == color) return;
516  old_color = color;
517 
518  static const uint8_t ansi_tab[] = { 30, 34, 32, 36, 31, 35, 33, 37 };
519  int code = 0;
520  fflush(changeStdErr ? stdout:stderr);
521  if(color != TS_NORMAL)
522  code = ansi_tab[color & (TS_BLUE|TS_GREEN|TS_RED)];
523  fprintf(changeStdErr ? stdout:stderr, "\x1b[%dm", code);
524 #endif
525 }
526 
527 const char* sLicenseTextF =
528 " Mobile Robot Programming Toolkit (MRPT) \n"
529 " http://www.mrpt.org/ \n"
530 " \n"
531 " Copyright (c) 2005-%Y, Individual contributors, see AUTHORS file \n"
532 " See: http://www.mrpt.org/Authors - All rights reserved. \n"
533 " Released under BSD License. See details in http://www.mrpt.org/License \n";
534 
536 {
537  static bool sLicenseTextReady = false;
538  static std::string sLicenseText;
539 
540  if (!sLicenseTextReady)
541  {
542  // Automatically update the last year of the copyright to the compilation date:
543  time_t rawtime;
544  struct tm * timeinfo;
545  time (&rawtime);
546  timeinfo = localtime (&rawtime);
547 
548  char buf[1024];
549  ::strftime(buf,sizeof(buf),sLicenseTextF,timeinfo);
550  sLicenseText = std::string(buf);
551  sLicenseTextReady=true;
552  }
553  return sLicenseText;
554 }
555 
556 #include <mrpt/mrpt_paths_config.h>
558 {
559  static bool mrpt_shared_first_call = true;
560  static std::string found_mrpt_shared_dir;
561 
562  if (mrpt_shared_first_call)
563  {
564  mrpt_shared_first_call = false;
565 
566  for (int attempt = 0; ; attempt++)
567  {
568  std::string dir;
569  switch (attempt)
570  {
571  case 0:
572  dir = string(MRPT_SOURCE_BASE_DIRECTORY) + string("/share/mrpt/");
573  break;
574  case 1:
575  dir = string(MRPT_INSTALL_PREFIX_DIRECTORY) + string("/share/mrpt/");
576  break;
577 #ifdef _WIN32
578  case 2:
579  {
580  char curExe[4096];
581  GetModuleFileNameA(NULL,curExe, sizeof(curExe));
582 
583  dir = mrpt::system::extractFileDirectory(std::string(curExe)) + "/../share/mrpt/";
584  }
585  break;
586 #endif
587 
588  default:
589  found_mrpt_shared_dir = ".";
590  break;
591  };
592  if (!dir.empty() && mrpt::system::directoryExists(dir))
593  found_mrpt_shared_dir = dir;
594 
595  if (!found_mrpt_shared_dir.empty())
596  break;
597  }
598  }
599 
600  return found_mrpt_shared_dir;
601 } // end of find_mrpt_shared_dir
602 
604  const std::string& command,
605  std::string* output/*=NULL*/,
606  const std::string& mode/*="r"*/)
607 {
608  using namespace std;
609 
610  // Create the stringstream
611  stringstream sout;
612 
613 #ifdef MRPT_OS_LINUX
614  // Run Popen
615  FILE *in;
616  char buff[512];
617 
618  // Test output
619  if (!(in = popen(command.c_str(), mode.c_str()))) {
620  sout << "Popen Execution failed!" << endl;
621  *output = sout.str();
622 
623  return -1;
624  }
625 
626  // Parse output
627  while(fgets(buff, sizeof(buff), in)!=NULL){
628  sout << buff;
629  }
630 
631  // Close
632  int exit_code = pclose(in);
633 
634  // set output - if valid pointer given
635  if (output) {
636  *output = sout.str();
637  }
638 
639  // Return exit code
640  return exit_code;
641 #else
642  MRPT_TODO("Write popen alternative for Windows")
643  THROW_EXCEPTION("not implemented for Windows yet!");
644 #endif
645 
646 } // end of executeCommand
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
Definition: os.cpp:358
GLuint GLuint GLsizei count
Definition: glext.h:3512
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
Definition: os.cpp:255
This class provides simple critical sections functionality.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
const char * sLicenseTextF
Definition: os.cpp:527
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:29
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
Definition: os.cpp:272
void BASE_IMPEXP pause(const std::string &msg=std::string("Press any key to continue...")) MRPT_NO_THROWS
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
Definition: os.cpp:435
time_t BASE_IMPEXP timegm(struct tm *tm)
An OS-independent version of timegm (which is not present in all compilers): converts a time structur...
Definition: os.cpp:116
#define THROW_EXCEPTION(msg)
void BASE_IMPEXP setConsoleColor(TConsoleColor color, bool changeStdErr=false)
Changes the text color in the console for the text written from now on.
Definition: os.cpp:489
#define MRPT_NO_THROWS
C++11 noexcept: Used after member declarations.
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Definition: datetime.h:70
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
Definition: os.cpp:412
STL namespace.
std::string BASE_IMPEXP MRPT_getCompilationDate()
Returns the MRPT source code timestamp, according to the Reproducible-Builds specifications: https://...
Definition: os.cpp:157
char BASE_IMPEXP * strcpy(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
An OS-independent version of strcpy.
Definition: os.cpp:296
GLuint src
Definition: glext.h:6303
int myKbhit(void)
Definition: os.cpp:69
#define MRPT_TODO(x)
unsigned char uint8_t
Definition: rptypes.h:43
std::string BASE_IMPEXP find_mrpt_shared_dir()
Finds the "[MRPT]/share/mrpt/" directory, if available in the system.
Definition: os.cpp:557
int BASE_IMPEXP executeCommand(const std::string &command, std::string *output=NULL, const std::string &mode="r")
Execute Generic Shell Command.
Definition: os.cpp:603
GLuint color
Definition: glext.h:7093
int BASE_IMPEXP getch() MRPT_NO_THROWS
An OS-independent version of getch, which waits until a key is pushed.
Definition: os.cpp:375
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
__int64 int64_t
Definition: rptypes.h:51
void BASE_IMPEXP clearConsole()
Clears the console window.
Definition: os.cpp:444
#define vsnprintf
Definition: zutil.h:204
TConsoleColor
For use in setConsoleColor.
Definition: os.h:158
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLsizei const GLchar ** string
Definition: glext.h:3919
GLint mode
Definition: glext.h:5078
unsigned __int64 uint64_t
Definition: rptypes.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: inftrees.h:28
bool BASE_IMPEXP kbhit() MRPT_NO_THROWS
An OS-independent version of kbhit, which returns true if a key has been pushed.
Definition: os.cpp:396
int BASE_IMPEXP _strcmpi(const char *str1, const char *str2) MRPT_NO_THROWS
An OS-independent version of strcmpi.
Definition: os.cpp:320
backing_store_ptr info
Definition: jmemsys.h:170
void my_aux_sighandler(int)
By ninjalj in http://stackoverflow.com/questions/3962263/checking-if-a-key-was-pressed.
Definition: os.cpp:67
GLuint in
Definition: glext.h:6301
GLsizei GLsizei GLchar * source
Definition: glext.h:3908
uint64_t BASE_IMPEXP _strtoull(const char *nptr, char **endptr, int base)
An OS-independent version of strtoull.
Definition: os.cpp:472
char BASE_IMPEXP * strcat(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
An OS-independent version of strcat.
Definition: os.cpp:281
GLbyte GLbyte tz
Definition: glext.h:5441
GLuint GLsizei bufSize
Definition: glext.h:3900
int BASE_IMPEXP int BASE_IMPEXP vsprintf(char *buf, size_t bufSize, const char *format, va_list args) MRPT_NO_THROWS
An OS-independent version of vsprintf (Notice the bufSize param, which may be ignored in some compile...
Definition: os.cpp:214
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
Definition: os.cpp:191
GLenum GLsizei GLenum format
Definition: glext.h:3513
bool BASE_IMPEXP directoryExists(const std::string &fileName)
Test if a given directory exists (it fails if the given path refers to an existing file)...
Definition: filesystem.cpp:132
std::string BASE_IMPEXP MRPT_getVersion()
Returns a string describing the MRPT version.
Definition: os.cpp:183
int64_t BASE_IMPEXP _strtoll(const char *nptr, char **endptr, int base)
An OS-independent version of strtoll.
Definition: os.cpp:459
int BASE_IMPEXP _strcmp(const char *str1, const char *str2) MRPT_NO_THROWS
An OS-independent version of strcmp.
Definition: os.cpp:312
int BASE_IMPEXP _strnicmp(const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
An OS-independent version of strnicmp.
Definition: os.cpp:344
const std::string BASE_IMPEXP & getMRPTLicense()
Returns a const ref to a text with the same text that appears at the beginning of each MRPT file (use...
Definition: os.cpp:535
std::string BASE_IMPEXP extractFileDirectory(const std::string &filePath)
Extract the whole path (the directory) of a filename from a complete path plus name plus extension...
Definition: filesystem.cpp:77
int BASE_IMPEXP _strncmp(const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
An OS-independent version of strncmp.
Definition: os.cpp:336



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020