Warning, /include/Geant4/tools/snpf is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_snpf
0005 #define tools_snpf
0006
0007 #include <cstdarg>
0008 #include <cstdio>
0009
0010 namespace tools {
0011
0012 inline int vsnpf(char* a_s,size_t a_n,const char* a_fmt,va_list args){
0013 #ifdef _MSC_VER
0014 #if _MSC_VER < 1900
0015 unsigned int old = _set_output_format(_TWO_DIGIT_EXPONENT);
0016 int status = _vsnprintf(a_s,a_n,a_fmt,args);
0017 _set_output_format(old);
0018 return status;
0019 #else
0020 return _vsnprintf(a_s,a_n,a_fmt,args);
0021 #endif
0022 #else
0023 return ::vsnprintf(a_s,a_n,a_fmt,args);
0024 #endif
0025 }
0026
0027 inline int snpf(char* a_s,size_t a_n,const char* a_fmt,...){
0028 va_list args;
0029 va_start(args,a_fmt);
0030 int n = vsnpf(a_s,a_n,a_fmt,args);
0031 va_end(args);
0032 return n;
0033 }
0034
0035
0036 }
0037
0038 #endif