C

File I/O in C (fopen, fprintf)

Në shqip: Skedarët në C

ShpjegimiSQ

Në C, një skedar e hap me fopen() ("r" për lexim, "w" për shkrim, "a" për shtim), shkruan me fprintf(), lexon me fgets() ose fscanf(), dhe e mbyll me fclose(). Kontrollo gjithmonë nëse fopen ktheu NULL.

EnglishEN

In C you open a file with fopen() ("r" to read, "w" to write, "a" to append), write with fprintf(), read with fgets() or fscanf(), and close it with fclose(). Always check whether fopen returned NULL.

Si ta mendosh

Si fletorja: e hap, shkruan ose lexon, dhe e mbyll kur mbaron — përndryshe faqet mund të përzihen.

Lexoje në anglisht

Like a notebook: open it, write or read, and close it when you're done — otherwise pages can get messed up.

Shembull kodic

FILE *f = fopen("notat.txt", "w");
if (f == NULL) return 1;
fprintf(f, "Arta %d\n", 5);
fclose(f);

Terma të lidhur