slibc
Functions
stdio_templates_.hpp File Reference

Contains overloaded templates for some _s-functions defined in stdio.h. More...

#include "./stdio.h"
#include <stdarg.h>

Go to the source code of this file.

Functions

template<rsize_t n>
int sprintf_s (char(&s1)[n], const char *restrict format,...)
 This function provides for fomatted output into buffer s while taking into account the size of s.
template<rsize_t n>
int snprintf_s (char(&s1)[n], const char *restrict format,...)
 This function provides for fomatted output into buffer s while taking into account the size of s.

Detailed Description

Contains overloaded templates for some _s-functions defined in stdio.h.

Usage of these templates is only possible in C++. For more information please consult the documentation in string_templates_.hpp


Function Documentation

template<rsize_t n>
int snprintf_s ( char(&)  s1[n],
const char *restrict  format,
  ... 
)

This function provides for fomatted output into buffer s while taking into account the size of s.

For statically allocated destination buffers this C++ template function automatically deducts snprintf' size argument n.

Parameters:
[out]s1The destination buffer
[in]formatformat string (equal to printf)
[in]...variable amount of parameters which are treated according to the specified format string.
Returns:
the number of characters that would have been written (not counting the null byte) had s1 been sufficiently large a negative number in case of an encoding error 0 in case of runtime-constraint violation

References vsnprintf_s().

template<rsize_t n>
int sprintf_s ( char(&)  s1[n],
const char *restrict  format,
  ... 
)

This function provides for fomatted output into buffer s while taking into account the size of s.

For statically allocated destination buffers this C++ template function automatically deducts sprintf' size argument n.

Parameters:
[out]s1The destination buffer
[in]formatformat string (equal to printf)
[in]...variable amount of parameters which are treated according to the specified format string.
Returns:
the number of characters written (not counting the null byte) a negative number in case of an encoding error 0 in case of runtime-constraint violation

References vsprintf_s().