Created
January 5, 2012 22:16
-
-
Save kubek2k/1567624 to your computer and use it in GitHub Desktop.
czytanie z pliku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
main() { | |
int wielkosc_bufora = 100; | |
char bufor[wielkosc_bufora]; // bufor do ktorego bedziemy czytac dane | |
FILE * plik; // zmienna zawierajaca uchwyt do pliku | |
plik = fopen("plik_wejsciowy.txt", "r"); // sciezka do pliku, tryb otwarcia do odczytu | |
fgets(bufor, wielkosc_bufora - 1, plik); // wczytanie pierwszych 99 bajtow pliku do bufora (PAMIETAJ - (wielkosc bufora - 1) poniewaz musisz zostawic miejsce na \0 w stringu | |
printf("%s", bufor); // wypisanie bufora | |
fclose(plik); // zamkniecie pliku | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jakies dane wejscioweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment