Back to Home & C
//Program to read student details from a file called stud
#include<stdio.h>
#include<conio.h>
void main()
{
int rno;
char name[20];
float mark;
FILE*file1;
clrscr();
file1=fopen("stud","r");
printf("Reading data from file...\n");
fscanf(file1,"%d%s%f",&rno,name,&mark);
printf("Printing Data...\n");
printf("Roll Number=%d\n",rno);
printf("name=%s\n",name);
printf("mark=%f\n",mark);
getch();
}
---------------------------------------------------------------
Output:
=========================================================================
Back to Home & C
//Program to read student details from a file called stud
#include<stdio.h>
#include<conio.h>
void main()
{
int rno;
char name[20];
float mark;
FILE*file1;
clrscr();
file1=fopen("stud","r");
printf("Reading data from file...\n");
fscanf(file1,"%d%s%f",&rno,name,&mark);
printf("Printing Data...\n");
printf("Roll Number=%d\n",rno);
printf("name=%s\n",name);
printf("mark=%f\n",mark);
getch();
}
---------------------------------------------------------------
Output:
=========================================================================
Back to Home & C
No comments:
Post a Comment