Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- char prviRed[100] = { 0 };
- char drugiRed[100] = { 0 };
- int brojacRedova = 0;
- FILE *fp;
- fp = fopen("Datoteka.txt", "r");
- if (fp == 0)
- perror("Nije ucitalo datoteku");
- while (!feof(fp))
- {
- if (brojacRedova == 0)
- {
- fgets(prviRed, 100, fp);
- brojacRedova++;
- }
- else if (brojacRedova == 1)
- {
- fgets(drugiRed, 100, fp);
- break;
- }
- }
- fclose(fp);
- printf("\n Prvi red je : %s", prviRed);
- printf("\n Drugi red je: %s", drugiRed);
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement