I'm writing a ctor that get a binary file and initialize the members of the class with the data. Unfortunately I can not figure out exactly how this works. I have 2 variables in the class one of them has type char * and the other is int. How do I know what to read first? This is what I have written so far, I would love advice.
Person::Person(ifstream& in_file)
{
int size;
in_file.read((char*)&size, sizeof(size));
m_name = new char[size + 1];
in_file.read(m_name, size);
m_color[size] = '\0';
in_file.read((char*)&m_age, sizeof(m_age));