C++

File I/O (fstream)

Në shqip: Skedarët në C++

ShpjegimiSQ

Me <fstream>, ifstream lexon nga skedarët dhe ofstream shkruan në to — me të njëjtat << dhe >> që i përdor me cout dhe cin. Skedari mbyllet vetë kur objekti del nga scope-i.

EnglishEN

With <fstream>, ifstream reads from files and ofstream writes to them — using the same << and >> you use with cout and cin. The file closes by itself when the object goes out of scope.

Si ta mendosh

Si fletorja e detyrave: me ofstream shkruan në të, me ifstream e lexon atë që ke shkruar dje.

Lexoje në anglisht

Like a homework notebook: with ofstream you write in it, with ifstream you read what you wrote yesterday.

Shembull kodicpp

#include <fstream>
std::ofstream dalja("notat.txt");
dalja << "Arta 5\n";
std::ifstream hyrja("notat.txt");

Terma të lidhur