#include <stdio.h>
#include <fstream.h>
double nome;
void main()
{
fstream rubrica_w("c:/rubrica.txt",ios::app);
while((nome = cin.get()) != '\n')
{
rubrica_w.put(nome);
rubrica_w.close();
}
fstream rubrica_r("c:/rubrica.txt",ios::beg);
while((nome = rubrica_r.get()) != '\n')
{
cout << nome;
rubrica_r.clear();
}
rubrica_r.close();
}
Dovrei leggere l'input da tastiera e scriverlo nel file rubrica.txt, e questo lo fa, poi una volta chiuso lo dovrei riaprire leggere dal file .txt e stamparlo a video, ma questo non riesco a farlo.
Mi aiutate?