The goal I am going for is to store values into a text file, and then populate an array from reading a text file.
At the moment, I store values into a text file;
Pentagon.CalculateVertices();//caculates the vertices of a pentagon
ofstream myfile;
myfile.open("vertices.txt");
for (int i = 0; i < 5; i++){
myfile << IntToString(Pentagon.v[i].x) + IntToString(Pentagon.v[i].y) + "\n";
}
myfile.close();
I have stored the values into this text file, now I want to populate an array from the text file created;
for (int i = 0; i < 5; i++){
Pentagon.v[i].x = //read from text file
Pentagon.v[i].y = //read from text file
}
this is all I have for now; can someone tell me how you can achieve what the code says.