Original Post
I'm using a STL vector to store (unfortunately) a char array. For some reason when I .push_back() an item to my vector it overwrites my other vector items!
main.cpp
application.cfg
The output I get from this example is
Any idea what I'm doing wrong?
Hope is the first step on the road to disappointment [edited by - tstrimp on April 29, 2003 9:56:25 PM]
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
fstream File;
char Temp[255];
vector<char*> Data;
File.open("application.cfg", ios::in);
while (!File.eof())
{
File.getline(Temp, 100);
Data.push_back(Temp);
}
unsigned int i;
for (i = 0; i < Data.size(); i++)
{
cout << Data[i] << endl;
}
return 0;
}
windowwidth 640 windowheight 480 bpp 32 fullscreen 0
fullscreen 0 fullscreen 0 fullscreen 0 fullscreen 0
Hope is the first step on the road to disappointment [edited by - tstrimp on April 29, 2003 9:56:25 PM]