Exemplu: /#include <fstream>ifstream fin("fisier.txt"); //deschiderea
ofstream fout("fisier.txt");void main(){int x;
fin >> x;
fout << x;
fout << "/nHello world!";
fin.close(); //inchiderea fisierului
fout.close();
}//putem folosi orice cuvant dorim in loc de fin/fout