From e3e96acb69ac6e205c16a33d9967f99d9a3f5b53 Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Sat, 31 May 2014 17:21:53 +1200 Subject: [PATCH] Fix for strings containing spaces. [04-string-download] --- tool/DataTypeHandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/DataTypeHandler.cpp b/tool/DataTypeHandler.cpp index ca7dcfed..abc55b6d 100644 --- a/tool/DataTypeHandler.cpp +++ b/tool/DataTypeHandler.cpp @@ -33,6 +33,7 @@ #include #endif +#include #include #include using namespace std; @@ -106,6 +107,8 @@ size_t DataTypeHandler::interpretAsType( stringstream str; size_t dataSize = type->byteSize; + memset(target, 0, targetSize); + #if DEBUG cerr << __func__ << "(targetSize=" << targetSize << ")" << endl; #endif @@ -192,7 +195,7 @@ size_t DataTypeHandler::interpretAsType( << dataSize << " > " << targetSize << ")"; throw SizeException(err.str()); } - str >> (char *) target; + str.read((char *) target, dataSize); break; case 0x0011: // double {