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