Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(void){
- FILE *fp;
- int a[5000];
- int j, k;
- fp = fopen("a.txt", "r");
- if (fp == NULL){
- printf("Cannot open %s.\n", "a.txt");
- exit(1);
- }
- for (j = 0; fscanf(fp, "%d", &a[j]) == 1; ++j)
- ;
- for (k = 0; k != j; k++)
- printf("%d\n", a[k]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment