Advertisement
Quzuri

doKolosa1.c

Nov 20th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int readLines(char *fileName, char textTable[][80])
  4. {
  5.     FILE *f=fopen(fileName,"r");
  6.     if (f==NULL) return -1;
  7.     for (int i=0;i<5;i++)
  8.     {
  9.        fgets(&textTable[i][0],80,f);
  10.    
  11.     }
  12.  
  13. return 0;
  14. }
  15. void displayArray(char textTable[][80])
  16. {
  17.     for (int i=0;i<5;i++)
  18.     {
  19.     fputs(&textTable[i][0],stdout);
  20.     }
  21. }
  22. int main()
  23. {
  24.     char textArray[5][80];
  25.     if (readLines("dane.txt", textArray)==-1) printf("GOWNO");
  26.     displayArray(textArray);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement