Skip to content

Instantly share code, notes, and snippets.

@firefly1250
firefly1250 / Snprintf.cpp
Created March 15, 2018 16:55
Light version of snprintf for embedded system. Type safety is ensured using variadic templates
#include <stdio.h>
class Snprintf {
static constexpr size_t MAX_NUMBER_LENGTH = 20;
unsigned char buffer[256];
unsigned char itr = 0;
struct Pad {
bool right = true;
bool zero = false;