daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main()
  5. {
  6.     char prviRed[100] = { 0 };
  7.     char drugiRed[100] = { 0 };
  8.     int brojacRedova = 0;
  9.  
  10.  
  11.     FILE *fp;
  12.     fp = fopen("Datoteka.txt", "r");
  13.     if (fp == 0)
  14.         perror("Nije ucitalo datoteku");
  15.  
  16.  
  17.     while (!feof(fp))
  18.     {
  19.         if (brojacRedova == 0)
  20.         {
  21.             fgets(prviRed, 100, fp);
  22.             brojacRedova++;
  23.         }
  24.  
  25.         else if (brojacRedova == 1)
  26.         {
  27.             fgets(drugiRed, 100, fp);
  28.             break;
  29.  
  30.         }
  31.  
  32.     }
  33.     fclose(fp);
  34.     printf("\n Prvi red je : %s", prviRed);
  35.     printf("\n Drugi red je: %s", drugiRed);
  36.  
  37.  
  38.     system("PAUSE");
  39.  
  40.    
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top