Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
asprintf.h
Go to the documentation of this file.
1#ifndef HUMIDISTAT_ASPRINTF_H
2#define HUMIDISTAT_ASPRINTF_H
3
4#include <stdlib.h>
5#include <stdio.h>
6
12template <typename... T>
13char * asprintf(const char *fmt, T... args) {
14 size_t len = snprintf(nullptr, 0, fmt, args...);
15 char *buf = new char [len+1];
16 sprintf(buf, fmt, args...);
17 return buf;
18}
19
20#endif //HUMIDISTAT_ASPRINTF_H
char * asprintf(const char *fmt, T... args)
Print formatted data to string. Automatically allocates string on the heap. Make sure to delete it im...
Definition asprintf.h:13