Tuesday 24 July 2012

How to Write Program for file I/O using fread and fwrite

How to Write Program for file I/O using fread and fwrite

struct employee
{
int id;
int name[30];
float sal;
}emp;

int main()
{
int i,n;

FILE *fwptr,*frptr;

//open file for writing
fwptr=fopen("emp.dat","wb");

// checking if file exists or not
if(fwptr==NULL)
{
printf("File doesn't exist");
return 0;
}

//Accepting number of records for writing
printf("How many records do you want?\n");
scanf("%d",&n);
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: