1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void create()
{
cout<<"\nReached create";
fflush(stdin);
account new_acc,temp;
int create_stat;
ifstream f1;
ofstream f2;
cout<<"\nAbout to recv";
recv(lsocket,(char*)&new_acc,sizeof(new_acc),0);
new_acc.show_details();
f1.open("F:\PRASHANT'S DOCUMENT\projects\class xii\NETWORK\BANKING\BANK.PG");
f2.open("F:\PRASHANT'S DOCUMENT\projects\class xii\NETWORK\BANKING\BANK.PG",ios::app);
while(1)
{
f1.read((char*)&temp,sizeof(temp));
if(!f1)
{
cout<<"File does'nt exist";
}
else
{
if(strcmp(new_acc.ret_acc_no(),temp.ret_acc_no())==0)
{
create_stat=0;
for(i=0;i<500;i++)
sendbuffer[i]=0;
strcpy(sendbuffer,(char*)&create_stat);
send(lsocket,sendbuffer,500,0);
return;
}
if(f1.eof())
{
break;
}
}
}
f2.write((char*)&new_acc,sizeof(new_acc));
create_stat=1;
for(i=0;i<500;i++)
sendbuffer[i]=0;
strcpy(sendbuffer,(char*)&create_stat);
send(lsocket,sendbuffer,500,0);
}
|