Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- struct person
- {
- int nr;
- char name[30];
- char surname[30];
- };
- int main()
- {
- char p[20];
- struct person input;
- FILE *inf;
- printf("name of the file\n");
- scanf("%s",p);
- inf=fopen(p,"r");
- while(fread(&p, sizeof(struct person), 1, inf))
- printf ("id = %d name = %s %s\n", input.nr,input.name, input.surname);
- fclose(inf);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement