Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Info
- {
- char name[10];
- int number;
- };
- int main()
- {
- struct Info in;
- FILE *fp;
- if((fp = fopen("input.txt", "rb")) == NULL)
- {
- printf("Error opening file.\n");
- exit(1);
- }
- if(fread(&in, sizeof in, 1, fp) != 1)
- {
- printf("Error reading file\n");
- exit(2);
- }
- fclose(fp);
- printf("%d %s\n", in.number, in.name);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement