#include <iostream>
#include <fstream>
using namespace std;
int const SIZE=50;
struct student
{
char
name[SIZE];
int
roll;
char
clas[SIZE];
};
int main()
{
student
std1;
ifstream
file("D://Ali.txt",ios::binary);
if(!file)
{
cout<<"File
is not located"<<endl;
}
else
{
file.read((char*)&std1,sizeof(std1));
cout<<"Name
:"<<std1.name<<"\nRoll No
:"<<std1.roll<<"\nClass
:"<<std1.clas<<endl;
}
file.close();
cout<<"File
is Read"<<endl;
return
0;
}
No comments:
Post a Comment