Switched to std::to_string, MSVC doesn't support snprintf.

This commit is contained in:
Markus Lampert 2016-12-11 08:04:13 -08:00
parent d43a6e6cef
commit 8f0549e965

View File

@ -34,7 +34,6 @@
#include <Base/Reader.h>
#include <Base/Exception.h>
#include "Command.h"
#include <stdio.h>
using namespace Base;
using namespace Path;
@ -132,12 +131,9 @@ std::string Command::toGCode (void) const
std::stringstream str;
str.precision(5);
str << Name;
char v[60];
for(std::map<std::string,double>::const_iterator i = Parameters.begin(); i != Parameters.end(); ++i) {
std::string k = i->first;
//std::string v = std::to_string(i->second); // only 6 digits
snprintf(v, sizeof(v), "%.9f", i->second);
v[sizeof(v)-1] = '\0';
std::string v = std::to_string(i->second);
str << " " << k << v;
}
return str.str();