int main(){
fstream plik;
plik.open("dane.txt", ios::out);
plik << "Aaaaan";
plik << "Aaaaa";
plik.close();
plik.open("dane.txt", ios::in);
while(!plik.eof()){
string linia;
plik >> linia;
cout << linia << " ";
}
plik.close();
plik.open("dane.txt", ios::out);
plik << "Baaaa";
}
i wanted to add text to an already created file, dunno why but append isnt working or im doing smth not properly
I wanted to add text (“Baaaa”) to a file that i created with this program before
New contributor
Bartosz Maziarz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1