i have a question about C++ program..
vector<Employee*> vecEmp; Employee newEmp = new Staff(); vecEmp[Emp::empNo] = newEmp;
and my question is :
how do i save this vector into a text file (.txt or .dat) by using std::fstream?
following my save method give me a run time error
*sigh....
void saveFile(vector<Employee*> newVecEmp)
{
int i = 0;
fstream file;
file.open(EMPLOYEE_FILE,ios::out|ios::trunc|ios::binary);
for(i=0; i < newVecEmp.size(); i++)
{
file.write((char*)&newVecEmp[i], sizeof(newVecEmp[i]));
}
}
a great thanks for you!

New Topic/Question
Reply




MultiQuote



|