Can’t Store Data in text file

Question

#include<stdio.h>
#include<conio.h>
#include<windows.h>
int main()
{
FILE *file;
char name[20];
int leangth = strlen(name);
int i,age,phn_num;
float result;

fopen(“admitionData.text”,”w”);
if(file==NULL)
{
printf(“Error”);
}

else
{
system(“cls”);
printf(” Enter Student First Name : “);
scanf(“%s”,name);
printf(” Enter Student Age : “);
scanf(“%d”,&age);
printf(” Enter Student Result(SSC + HSC) : “);
scanf(“%f”,&result);
printf(“Enter Student Phone Number : “);
scanf(“%d”,&phn_num);
fprintf(file,”%s%s%d%f%d”,name,age,result,phn_num);
printf(” Data Storing ! PLEASE WAIT “);
for(i=0; i<=30; i++)
{
Sleep(100);
printf(“*-“);
}
printf(“This Student’s Data Index Successfully”);
fclose(file);
}

getch();
}

0
tanvirreza0 3 weeks 0 Answers 15 views 0

Leave an answer