D
Dima12334
создание файла производится на с или с++ ???
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <io.h>
#include <dos.h>
#include "FUNC.cpp"
char ch, *file;
int err=0, size=0;
extern char *file;
void create();
void main()
{
clrscr();
cout<<"Viberite deistvie:"<<endl;
cout<<"1. Otkrit' bazu"<<endl;
cout<<"2. Sozdat' bazu"<<endl;
cout<<"3. Vihod"<<endl;
do ch=getch();
while((ch!='1')&&(ch!='2')&&(ch!='3'));
if (ch=='3') exit(0);
if (ch=='2') create();
if (ch=='1') {
while (err==0){
cout<<"Please enter name file: "<<endl;
char *name;
FILE *f;
cin>>name;
if ((f=fopen(name,"r"))==NULL){
cout<<"File not found!"<<endl;
}
else{
err=1;
file=new char(strlen(name));
strcpy(file,name);
fclose(f);
open(file);
}
}
}
delete file;
}
void create(){
cout<<"Vvedite imya novogo faila: ";
char *name;
cin>>name;
cout<<"\r\nSozdanie...\r\n";
FILE *f;
if ((f=fopen(name,"w"))==NULL){
cprintf("Oshibka!!!");
getch();
exit(1);
}
file=new char(strlen(name));
strcpy(file,name);
fclose(f);
open(file);
}
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <io.h>
#include <dos.h>
#include "FUNC.cpp"
char ch, *file;
int err=0, size=0;
extern char *file;
void create();
void main()
{
clrscr();
cout<<"Viberite deistvie:"<<endl;
cout<<"1. Otkrit' bazu"<<endl;
cout<<"2. Sozdat' bazu"<<endl;
cout<<"3. Vihod"<<endl;
do ch=getch();
while((ch!='1')&&(ch!='2')&&(ch!='3'));
if (ch=='3') exit(0);
if (ch=='2') create();
if (ch=='1') {
while (err==0){
cout<<"Please enter name file: "<<endl;
char *name;
FILE *f;
cin>>name;
if ((f=fopen(name,"r"))==NULL){
cout<<"File not found!"<<endl;
}
else{
err=1;
file=new char(strlen(name));
strcpy(file,name);
fclose(f);
open(file);
}
}
}
delete file;
}
void create(){
cout<<"Vvedite imya novogo faila: ";
char *name;
cin>>name;
cout<<"\r\nSozdanie...\r\n";
FILE *f;
if ((f=fopen(name,"w"))==NULL){
cprintf("Oshibka!!!");
getch();
exit(1);
}
file=new char(strlen(name));
strcpy(file,name);
fclose(f);
open(file);
}