Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- char textFile[5][5];
- FILE *f = fopen("plik.txt", "r");
- if(f == NULL) printf("Nie udalo sie otworzyc pliku\n");
- int i = 0, j = 0;
- char c;
- while((c = getc(f)) != EOF)
- {
- textFile[i][j] = c;
- if(c == '\n')
- {
- i++; j=0;
- }
- else j++;
- }
- for(i = 0; i < 5; i++)
- {
- for(j = 0; j < 5; j++)
- printf("%c", textFile[i][j]);
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment