#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;
ofstream
file("D://Ali.txt",ios::binary);
cout<<"Enter
name :";
cin>>std1.name;
cout<<"Enter
Roll No :";
cin>>std1.roll;
cout<<"Enter
Class :";
cin>>std1.clas;
file.write((char*)&std1,sizeof(std1));
cout<<"File
is write"<<endl;
file.close();
return
0;
}
No comments:
Post a Comment