JAYASHREE ORACLE CERTIFIED JAIN UNIVERSITY

Monday, October 11, 2010

PROGRAM ON SEQUENTIAL FILE

/*PART B:Program11:Create sequential file with three fieldempname,empname,empbasic Print All the details in a neat format by adding 500 to their basic salary.*/

#include<>
main()
{
FILE *fp;
int,empno,empbasic.i;
char empname[10];

fp=fopen(“empdatabase.txt”,”w”);

printf(“Input employee data”);
printf(“EMPNO EMPNAME EMPBASIC”);

for(i=1;i< =3;i++)
{
fscanf(stdin,”%d%s%d”,&empno,empname,&empbasic);
fprintf(fp,”%s%d%f%d%d”,empno,empname,empbasic,empbasic+500);
}

fclose (fp);
fp=fopen(“empdatabase.txt”,”r”);
printf(“EMPNO EMPNAME EMPBASIC”);

for(i=1;i< =3;i++)
{
fscanf(fp,”%d%s%d%d”,&empno,ename,&empbasic,empbasic+500);

fprintf(“stdout,”%d%s%d”,empno,empname,empbasic);
}
fclose(fp);

}

1 comment:

  1. Mam, can u give me the below program detailsem?
    Program:Write a c-programe to read two different N-numbers & arrange the number in ascending order....to my email id:akshay.metri@ymail.com
    akshaymetri1269@gmail.com

    ReplyDelete