I'm trying to figure out how to do template lists. I have this

GList<int> list1;
	GList<float> list2;
	GList<string> list3;
	ifstream inFile;
	inFile.open("data.txt");
	while(!inFile.eof()){

The code keeps going but that is about all that is important. The data.txt consists of ints, floats, and strings, which are separated by "I"'s, "F"'s, and "S"'s. I'm trying to store the data type in the correct list. I know that I need to find an "I", then get the next item after it, which is an int, and do that for the floats and strings. Would I store the data.txt in a sting, then someway get the info from that? I've tried that way but I just get the can't convert to int error. Any suggestions?

From the slightly overly-short section of code, (please post the rest of the while(!inFile.eof()) {.... })

I am guessing that you do not actually read any file.
inFile.eof() only checks the state of the file (it is not at the end)
If you do not have a readline / operator>> / getc or some such function, your file never advances and the while condition is always true.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.