hey every body,
in my project-Emergency room Simulator- i should open file for all patient if he didnt have one, so, when the patient come,
i will ask him if he has a file, if yes, i will read his information and add some more in it, if not
i will open new file for him, i'll receve the patient as node of Queue, then i will write his information in a file.
this is my Code, and as u see there r problem with the concatenation of these strings then put it between quotationMark
void read_patient_file(Patient &patient,string fn)
{
string extention=".txt";
string file_num;
for (int d=0;d< fn.length();d++)
file_num[d]=fn[d];
string loction="C:\\";
string file_name=loction+file_num+extention;
ifstream infile;
infile.open("file_name", ios::in);
if(!infile)
{
cout<<"file could not open";
exit(1);
}
infile>>patient.name>>patient.age>>patient.gender>>patient.fileNumber>>patient.illness>>patient.degree;
infile.close();
}
void patient_file(Patient patient)
{
string file_num,extention,loction,file_name;
extention=".txt";
file_num=patient.fileNumber;
loction="C:\\pateint";
file_name=loction+file_num+extention;
ofstream ofile ("file_name", ios::out);
if(!ofile)
{
cout<<"Can't open output file";
exit(1);
}
ofile<<patient.name<<' '<<patient.age<< ' '<<patient.gender<< ' '<<patient.fileNumber<< ' '<<patient.illness<< ' '<<patient.degree;
ofile.close();
}
how could i solve this problem,
and if i want to gather all patient file in One fail (patient record) how could i do it?
void patient_record()//record of all patient
{
ofstream ofile ("C:\\pateint.txt", ios::out);
if(!ofile)
{
cout<<"file could not open";
exit(1);
}
ofile.close();
}
hope u can help me sooon
thank u