#include<stdio.h>
#include<conio.h>
struct emp
{char name[20];
int id;
}e;
void main()
{ char ch='y';
int i;
FILE *pk=fopen("keviv.txt","a+");
clrscr();
if(pk==NULL)
{ printf("\n\n FILE DOES NOT EXIST");
getch();
exit(0);
}
while(ch=='y')
{ printf("\n\n Enter records of employee:\n");
printf("\n Enter name: ");
scanf("%s",e.name);
printf("\n Enter ID: ");
scanf("%d",&e.id);
//i=ftell(pk);
//fseek(pk,i,0);
fprintf(pk," %s %d\n",e.name,e.id);
printf("\n\n Do u want to continue...(Y/N): ");
fflush(stdin);
scanf("%c",&ch);
}
fclose(pk);
}
Comments
Post a Comment