--- deliantra/server/include/util.h 2006/09/11 23:33:30 1.8 +++ deliantra/server/include/util.h 2006/09/12 18:15:34 1.9 @@ -118,5 +118,14 @@ template static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } +// basically does what strncpy should do +template +inline void assign (char (&dst)[N], const char *src) +{ + // should be optimised at some point, maybe should also add "..." + // when buffer is too small. + snprintf (dst, N, "%s", src); +} + #endif