#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<ifstream.h>
struct employee
{
int code;
char fname[20],lname[20];
float sal;
};
void main()
{
employee edata;
ifstraem efile("c://tc//bin//emp.txt";ios::in/ios::binary);
employee data;
if(!efile){cout<<"file opening error";getche(); exit(0);}
while(efile)
{
efile.read((char*) & edata, size of edata);
cout<<edata.code<<"\t"<<edata.fname<<"\t"<<edata.lname<<"\t"<<edata.sal<<endl;
}
getch();
}
No comments:
Post a Comment