unable to create new file with user entered name

I want to copy the contents of an existing binary file to a new user created one but the file is not getting created.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
case 3:  
{  
fio.open("mh.dat",ios::in);
string date;
cout<<"Enter today's date in DD/MM/YYYY(file name for archival record)";
cin>>date;
date+=".dat";
ofstream fo(date.c_str(),ios::out);
while(fio.read((char*)&m,sizeof(m)))
    fo.write((char*)&m,sizeof(m));
fio.close();
fo.close();
break;
}
The file name will not be valid if it contains the / character.
Thanks a lot, i changed it to dd-mm-yyyy and it works
Topic archived. No new replies allowed.