/* program to understand the use of fprintf() */
main()
{
*fptr;
name[15];
salary;
((fptr=fopen("rec","w"))==NULL)
{
printf("Error in opening file \n");
(1);
}
printf("Enter name and salary :" );
scanf("%s%d", &name,&salary);
fprintf(fptr," name is %s and salary %d",name,salary);
fclose(fptr);
0;
}
|