@angala wrote:
/* read by block & display the structure Program#233 A */ #include<stdio.h> main(int argc,char *argv[]) { int i,p; char a[512]; union xyz{ struct bio{ char name [20], addr [20]; int age; float salary; }a; char b[sizeof(struct bio)]; }; union xyz m; if(argc!=2) { printf("error: no.of arg"); return 0; } p=open(argv[1], 0); if(p==-1) { printf("file open error"); return 0; } i=read(p,m.b,512); while(i>0) { printf("%s %d %f %s", m.a.name, m.a.age, m.a.salary, m.a.addr); i=read(p,m.b,512); close(p); } }
Posts: 1
Participants: 1