Skip to content
Snippets Groups Projects
Commit a03940e0 authored by Pascal Pieper's avatar Pascal Pieper
Browse files

Correct deserialisation

parent 47a7f9a9
No related branches found
No related tags found
No related merge requests found
......@@ -96,9 +96,10 @@ public:
{
size_t len;
s.read(reinterpret_cast<char*>(&len), sizeof(size_t));
char buf[len];
char buf[len+1];
s.read(buf, len);
string file = buf;
buf[len] = 0;
string file(buf);
size_t points;
s.read(reinterpret_cast<char*>(&points), sizeof(size_t));
cout << "File " << file << ": " << points << " points" << endl;
......@@ -140,7 +141,7 @@ public:
{
if(visitedPoints.find(file) == visitedPoints.end())
{ //new file
visitedPoints[file] = vector<VisitedWithLine>();
visitedPoints[string(file)] = vector<VisitedWithLine>();
}
if(visitedPoints[file].size() <= counter)
{ //New point in file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment