Just so im sure that im not getting any memory leaks from these things.
char* p;
p = agk::ReadLine(1);
asteroids[i].Type = agk::Val(p);
delete[] p;
p = agk::ReadLine(1);
asteroids[i].x = agk::Val(p);
delete[] p;
p = agk::ReadLine(1);
asteroids[i].y = agk::Val(p);
delete[] p;
p = agk::ReadLine(1); //Reading the empty line containing no info
delete [] p;
Edit: I just found something that I think may cause a problem for me...
Since I send some strings on the network, I create some char*'s but when I delete them, I get some werid erros. Now that I think about it, it makes sense, but it dosn't seem like im doing things correctly. Basicaly if I do this:
char* p;
p = agk::GetNetworkMessageString(msg);
sectors[0].name = p;
//delete[] p;
p = agk::GetNetworkMessageString(msg);
sectors[0].background = p;
//delete[]p;
I get the correct strings, but if I have understood these things correctly, this will cause a memory leak. So in order to fix this, I added the delete[p] command after every loading, but now I get some weird strings. I realise that I delete the strings from the memory when doing delete[], but this would mean that I would have to have 1 char* / string I want to save in my program. Which would be a bit anoying. Have I understood things correctly or am I doing it wrong?