do
{
do
{
choose=1;
cout << "Saving text into a file...\nPath: ";
cin >>path;
ftest.open(path);
if (!(!ftest)) {cout<<"\nYou have chosen the existing file. Do you want to overwrite it? (1-Yes,0-No)\n";
cin >> choose;}
}
while (choose==0);
//ftest.close();
choose=1;
fout.open(path,0x02); //rewrite only
if (!fout) {cout << "Error: Can't open file for overwriting.\nDo you want to try again " << "(1-Yes/0-No):";
cin >> choose;}
if (choose==0) return 1;//here is a mistake
}
while (!fout);
free (path);
student::fdisplay_all(fout);
fout.close();
return 0; //all is alright
}
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
int menu(char* fname)
{ int choose;
ifstream fmenu;
int min,max;
char** record;
char buf;
system("cls");
fmenu.open(fname);
if (!fmenu) {cout<<"Error in opening menu info file: "<<fname; return (-1);}
fmenu>>min>>max;
if (fmenu.peek()=='\n') buf=fmenu.get();
record= (char**) calloc ((max-min+1),80*sizeof(char));
for (int i=min; i<max+1; i++)
{
record[i-min]=new char [80];
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.