MonkOS  v0.1
A simple 64-bit operating system (x86_64)
stdio.h
Go to the documentation of this file.
1 //============================================================================
2 /// @file stdio.h
3 /// @brief Standard i/o library.
4 //
5 // Copyright 2016 Brett Vickers.
6 // Use of this source code is governed by a BSD-style license that can
7 // be found in the MonkOS LICENSE file.
8 //============================================================================
9 
10 #pragma once
11 
12 #include <core.h>
13 #include <stdarg.h>
14 
15 //----------------------------------------------------------------------------
16 // @function snprintf
17 /// @brief Compose a printf-formatted string into the target buffer.
18 /// @details If the length of the string is greater than n-1 characters,
19 /// truncate the remaining characters but return the total number
20 /// of characters processed.
21 /// @param[in] buf Pointer to a buffer where the resulting string is
22 /// to be stored.
23 /// @param[in] n Maximum number of characters in the the buffer,
24 /// including space for a null terminator.
25 /// @param[in] format A format-specifier string.
26 /// @param[in] ... A variable argument list based on the contents of the
27 /// format string.
28 /// @returns The number of characters that would have been written if
29 /// n was sufficiently large.
30 //----------------------------------------------------------------------------
31 int
32 snprintf(char *buf, size_t n, const char *format, ...);
33 
34 //----------------------------------------------------------------------------
35 // @function vsnprintf
36 /// @brief Compose a printf-formatted string into the target buffer using
37 /// a variable argument list.
38 /// @details If the length of the string is greater than n-1 characters,
39 /// truncate the remaining characters but return the total number
40 /// of characters processed.
41 /// @param[in] buf Pointer to a buffer where the resulting string is
42 /// to be stored.
43 /// @param[in] n Maximum number of characters in the the buffer,
44 /// including space for a null terminator.
45 /// @param[in] format A format-specifier string.
46 /// @param[in] arg Variable arguments list to be initialized with
47 /// va_start.
48 /// @returns The number of characters that would have been written if
49 /// n was sufficiently large.
50 //----------------------------------------------------------------------------
51 int
52 vsnprintf(char *buf, size_t n, const char *format, va_list arg);
Core include file.
int vsnprintf(char *buf, size_t n, const char *format, va_list arg)
Compose a printf-formatted string into the target buffer using a variable argument list...
int snprintf(char *buf, size_t n, const char *format,...)
Compose a printf-formatted string into the target buffer.