#include<stdio.h>
struct student
{
char name[20];
int rollno, fees;
};
main()
{
struct student s;
FILE *fp;
fp = fopen("data.dat", "wb");
if(fp == NULL)
{
printf("Error opening file!");
return;
}
printf("Enter the Name : ");
scanf("%s", s.name);
printf("\n Enter Roll No. :");
scanf("%d", &s.rollno);
printf("\n enter the Fees : ");
scanf("%d", &s.fees);
fwrite(&s, sizeof(s), 1, fp);
fclose(fp);
}