Right now I am reading a XML file into a char pointer array, and storing the value in that array into a stack. I'm reading every line into the same char pointer array so when I delete it and replace it, all of the values in the stack get changed to the new value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
*while(!pfile.eof())
{
pfile.get(c);
while (c != '\n' && !pfile.eof())
{
buffer[inc++] = c;
pfile.get(c);
}
tags.push(buffer); // everything in this will change to the new values
memset(buffer, 0, sizeof (buffer));
}
Question: How can I store each line read by my program so that the values don't change when I empty the char pointer array, and replace it with the new line?
buffer is a char pointer, I guess I can try that but wont I have the same problem with it storing the address of the string and not the value that it holds?