#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ofstream file_testo;
file_testo.open("file_testo.txt",ios_base::out|ios_base::trunc);
file_testo << "Prova 1" << endl;
file_testo << "Prova 2" << endl;
file_testo.close();
ifstream file_testo_input;
string stringa;
file_testo_input.open("file_testo.txt",ios_base::in);
if (file_testo_input.is_open())
{
while (file_testo_input.good())
{
getline(file_testo_input,stringa);
cout << stringa << endl;
}
}
file_testo_input.close();
return 0;
}
Nessun commento:
Posta un commento