LibCT 2.0

Include/FormatString.h

Go to the documentation of this file.
00001 // ------------------------------------------------------------------
00012 #ifndef _LIBCT_FORMATSTRING_H
00013 #define _LIBCT_FORMATSTRING_H
00014 
00015 #include <stdio.h>
00016 #include <stdarg.h>
00017 #include <string>
00018 
00019 namespace LibCT
00020 {
00022         template<unsigned int size>
00023         static std::string FormatString(
00024                 const char* pFormat,    
00025                 ...                                             
00026                 )
00027         {
00028                 char buffer[size];
00029                 va_list args;
00030                 va_start(args, pFormat);
00031                 vsprintf_s(buffer, size, pFormat, args);
00032                 va_end(args);
00033                 return std::string(buffer);
00034         };
00035 }
00036 
00037 #endif // _LIBCT_FORMATSTRING_H