Prog#212: edit the 'n'th record

/*
edit the 'n'th record
Program#212
*/
#include<stdio.h>
main(int argc,char *argv[])
{
union xyz{
struct bio{
char name [20], addr [20];
int age;
float salary;
}a;
char b[sizeof(struct bio)];
};
union xyz m;
FILE *fp;
int i, len, n;
if(argc!=2)
{
printf("error. no.of arg");
return 0;
}
fp=fopen (argv[i], "r+");
if(fp==NULL)
{
printf("file open error");
return 0;
}
scanf("%d", &n);
len=(n-1)*sizeof(struct bio);
fseek(fp, len, 0);
for(i=0;i<sizeof(struct bio);i++)
m.b[i]=getc(fp);
printf("%s %d %f %s", m.a.name, m.a.age, m.a.salary, m.a.addr);
scanf("%s %d %f %s", m.a.name, & m.a.age, & m.a.salary, m.a.addr);
fseek(fp, len, 0);
for(i=0;i<sizeof(struct bio);i++)
putc(m.b[i], fp);
fclose(fp);
}