In the code below the problem is the program is terminating without allowing for input (and thus not saving). Can anybody please help? oh btw, at first the output (please enter location to store) was also not showing automatically until i added the flush instruction. Thanks in advance. (no errors or warnings reported on compile)
void save(struct database outit[3])
{
char filename[20];
int mode = (ios:ut);
int index=0;
cout << "Please enter location to store: ";
cout.flush() // wasn't even displaying this
cin.getline(filename,20);
fstream fout(filename, mode);
for (index=0; index < 4; index++)
{
fout << outit[index].name;
fout << outit[index].age;
}
fout.close();
}
Warren Brown
wazzer@btinternet.com
void save(struct database outit[3])
{
char filename[20];
int mode = (ios:ut);
int index=0;
cout << "Please enter location to store: ";
cout.flush() // wasn't even displaying this
cin.getline(filename,20);
fstream fout(filename, mode);
for (index=0; index < 4; index++)
{
fout << outit[index].name;
fout << outit[index].age;
}
fout.close();
}
Warren Brown
wazzer@btinternet.com