Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Friday, May 20, 2011

C35 : Write and read employee details from a file

Back to Home   &  C


//Program to write and read employee details from a file

#include<stdio.h>
#include<conio.h>
void main()
{
int code;
char name[20];
FILE*fp;
fp=fopen("emp.dat","w+");
clrscr();
printf("Enter employee code");
scanf("%d",&code);
printf("Enter name");
scanf("%s",name);
printf("Writing to file...\n");
fprintfp("%d%s",code,name);
printf("Reading from file...\n");
fprint(fp,"%d%s",&code,name);
printf("Employee code=%d\n",code);
printf("Name=%s\n",name);
getch();
}
---------------------------------------------------------------------
Output :

=========================================================================
Back to Home   &  C


No comments: