Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct { int hi; int mon; char[35] dat; } S;
- S s;
- S arr[22];
- int f;
- // write
- f = open(/* I forget the args*/);
- // one
- if(sizeof(s) != write(f, &s, sizeof(s))) Error();
- // many
- if(sizeof(arr) != write(f, arr, sizeof(arr))) Error();
- close(f);
- // read
- f = open(/* I forget the args*/);
- // one
- if(sizeof(s) != read(f, &s, sizeof(s))) Error();
- // many
- if(sizeof(arr) != read(f, arr, sizeof(arr))) Error();
- close(f);
Add Comment
Please, Sign In to add comment