cout<<"enter name of file : " <<endl;
char nof[30] ;
for (int i=0;i<20;++i){
cin>>nof[i];
if (nof[i-1]=='x'){
if (nof[i]=='t'){
break;
}
}
}
fstream file1;
file1.open(nof);
if (file1.is_open()) cout<<"file is open"<<endl;
that is a code which should take the name of file from user to create
but i checked if it is opened and it is not , what to do ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…