Skip to content

Commit

Permalink
_snprintf on old vs
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Feb 2, 2016
1 parent a5ea683 commit 0f63b54
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/ArduinoJson/Arduino/Print.hpp
Expand Up @@ -9,13 +9,20 @@

#ifndef ARDUINO

#include "../Internals/JsonInteger.hpp"
#include "../Internals/JsonFloat.hpp"
#include "../Internals/JsonInteger.hpp"

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

#if defined(_MSC_VER) && _MSC_VER <= 1800
// snprintf has been added in Visual Studio 2015
#define SNPRINTF _snprintf
#else
#define SNPRINTF snprintf
#endif

// This class reproduces Arduino's Print class
class Print {
public:
Expand All @@ -39,7 +46,7 @@ class Print {

if (isBigDouble) {
// Arduino's implementation prints "ovf"
// We prefer trying to use scientific notation, since we have sprintf
// We prefer using the scientific notation, since we have sprintf
snprintf(tmp, sizeof(tmp), "%g", value);
} else {
// Here we have the exact same output as Arduino's implementation
Expand Down

0 comments on commit 0f63b54

Please sign in to comment.