I have me problem in finding the error in the folowing program.the program writes all the information in an encrypted form would you help me in making it readable please?
the program is:

#include <iostream>
#include<fstream>
using namespace std;
struct customer
{
    string fname;
    string Lname;
    int id;
};
int main()
{
  for(int i=0;i<2;i++)
{
 customer c;
 ofstream outfile;
 outfile.open("c:\\creat.txt",ios::in|ios::badbit);
 cout<<"enter fname"<<endl;
 cin>>c.fname;
 cout<<"enter Lname "<<endl;
 cin>>c.Lname;
 cout<<"enter id"<<endl;
 cin>>c.id;
  outfile.seekp((c.id*0)*sizeof(c));
  outfile.write((char*)&c,sizeof(c));

}
    return 0;
}
avarionist commented: i have reason to believe that you dont fully understand the code ask again when you have more knowledge. sorry but we can't help you if you can't isolate the error and tell us what the compiler is spitting out. sorry :( +0

You need to remove the "|ios::badbit" from the code. IT should work after that.