Hi.

Firs about the problem. I am trying to get a code to read data in binary mode, which is will safe in a character array. Once done, I want the program to insert each character in the character array into an STL container: list. For some reason, I could use "mylist.push_back(array[i])" or "mylist.insert(array[i]). here is the code:

Code:
void save::saveData(ifstream &source, ofstream &output)
{
	char *inData;
	std::list<char *> dataList;
	source.seekg(0, ios::end);
	int sourceSIZE = source.tellg();
	source.seekg(0, ios::beg);
	inData = new char[sourceSIZE];
	source.read(reinterpret_cast<char *>(inData), sourceSIZE);
	for (int i = 0; inData[i] != NULL; i++)
	{
		cout << inData[i] << " ";
		dataList.push_back(inData[i]);
	}

	std::ostream_iterator<char *> outFile(output, "\n");
	std::copy(dataList.begin(), dataList.end(), outFile);
}
My second question is how do you assign a value to whatever a particular iterator points to? For example:

std::list<char> dataList;
std::list<char>::iterator iterList = dataList.begin();

for (int i = 0; i < 100; i++)
{
iterList = i;
iterList++;
}

The code above does not work. It seems it is only possible to determine the value "iterList" points to using dereference. How about for assigning a value to it?

Thanks,
Kuphryn