float* hu_geometry = new float(dim);
int* hu_temp = new int(dim);
those are 1-char arrays containing the value dim
. At some point you're hitting a MMU boundary and crashes randomly.
You want to write:
float* hu_geometry = new float[dim];
int* hu_temp = new int[dim];
or maybe better with vectors, pre-allocated with dim
elements
#include
std::vector hu_geometry(dim);
std::vector hu_temp(dim);
or not allocated at start:
std::vector hu_temp;
and in your code:
hu_temp.push_back(stoi(line));
(hu_temp.size()
gives the size and a lot of very nice features better described here)