se vi può essere di aiuto questo è il codice:
#include <iostream.h>
#include <fstream.h>
#include <string.h>
using namespace std;
struct alunno{
char nome[15];
char cognome[15];
int ita;
int inf;};
alunno v[2];
int main ()
{
fstream file;
char stringa[20]="ciao mondo";
char stringa1[50];
file.open("file.txt",ios:ut | ios::binary);
if(!file){
cout << "I/O ERROR" << endl;
system("pause");
exit(1);}
else
file << stringa << endl;
file << stringa << endl;
file.close();
file.open("file.txt", ios::in | ios::binary);
while(!file.eof()){
file >> stringa1;
cout << stringa1;}
file.close();
system("pause");
return 0;
}