… | |
… | |
676 | erase (&obj); |
676 | erase (&obj); |
677 | } |
677 | } |
678 | }; |
678 | }; |
679 | |
679 | |
680 | // basically does what strncpy should do, but appends "..." to strings exceeding length |
680 | // basically does what strncpy should do, but appends "..." to strings exceeding length |
|
|
681 | // returns the number of bytes actually used (including \0) |
681 | void assign (char *dst, const char *src, int maxlen); |
682 | int assign (char *dst, const char *src, int maxsize); |
682 | |
683 | |
683 | // type-safe version of assign |
684 | // type-safe version of assign |
684 | template<int N> |
685 | template<int N> |
685 | inline void assign (char (&dst)[N], const char *src) |
686 | inline int assign (char (&dst)[N], const char *src) |
686 | { |
687 | { |
687 | assign ((char *)&dst, src, N); |
688 | return assign ((char *)&dst, src, N); |
688 | } |
689 | } |
689 | |
690 | |
690 | typedef double tstamp; |
691 | typedef double tstamp; |
691 | |
692 | |
692 | // return current time as timestamp |
693 | // return current time as timestamp |