AceCommon
1.4.6
Arduino library for low-level common functions and features with no external dependencies
src
print_utils
printfTo.h
Go to the documentation of this file.
1
/*
2
* MIT License
3
* Copyright (c) 2018 Brian T. Park
4
*/
5
33
#ifndef ACE_COMMON_PRINTF_TO_H
34
#define ACE_COMMON_PRINTF_TO_H
35
36
#include <stdio.h>
// vsnprintf()
37
#include <stdarg.h>
// va_list, va_start(), va_end()
38
39
class
Print;
40
41
namespace
ace_common {
42
44
const
int
PRINTF_TO_BUF_SIZE
= 192;
45
47
inline
void
vprintfTo
(Print& printer,
const
char
*fmt, va_list args) {
48
char
buf[
PRINTF_TO_BUF_SIZE
];
49
vsnprintf(buf,
PRINTF_TO_BUF_SIZE
, fmt, args);
50
printer.print(buf);
51
}
52
59
inline
void
printfTo
(Print& printer,
const
char
* fmt, ...) {
60
va_list args;
61
va_start(args, fmt);
62
vprintfTo
(printer, fmt, args);
63
va_end(args);
64
}
65
66
}
67
68
#endif
ace_common::vprintfTo
void vprintfTo(Print &printer, const char *fmt, va_list args)
Helper function for implementing the printfTo() function.
Definition:
printfTo.h:47
ace_common::PRINTF_TO_BUF_SIZE
const int PRINTF_TO_BUF_SIZE
Maximum size of the internal stack buffer used by printfTo().
Definition:
printfTo.h:44
ace_common::printfTo
void printfTo(Print &printer, const char *fmt,...)
A printf() that works on an Arduino Print object using the built-in vsnprintf().
Definition:
printfTo.h:59
Generated by
1.8.17