g4tools  5.4.0
snpf
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_snpf
5 #define tools_snpf
6 
7 #include <cstdarg>
8 #include <cstdio>
9 
10 namespace tools {
11 
12 inline int vsnpf(char* a_s,size_t a_n,const char* a_fmt,va_list args){
13 #ifdef _MSC_VER
14 #if _MSC_VER < 1900
15  unsigned int old = _set_output_format(_TWO_DIGIT_EXPONENT);
16  int status = _vsnprintf(a_s,a_n,a_fmt,args);
17  _set_output_format(old);
18  return status;
19 #else
20  return _vsnprintf(a_s,a_n,a_fmt,args);
21 #endif
22 #else
23  return ::vsnprintf(a_s,a_n,a_fmt,args);
24 #endif
25 }
26 
27 inline int snpf(char* a_s,size_t a_n,const char* a_fmt,...){
28  va_list args;
29  va_start(args,a_fmt);
30  int n = vsnpf(a_s,a_n,a_fmt,args);
31  va_end(args);
32  return n;
33 }
34 
35 
36 }
37 
38 #endif
tools::args
Definition: args:24
tools::snpf
int snpf(char *a_s, size_t a_n, const char *a_fmt,...)
Definition: snpf:27
tools::vsnpf
int vsnpf(char *a_s, size_t a_n, const char *a_fmt, va_list args)
Definition: snpf:12
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26