The problem is that i need to save in simple way the array of structure:
struct gydytojas {
int gydid, amzius, specialyb, telefonas, asmkod;
String vardas[25];
String pavarde[35];
String adresas[50]; };
gydytojas gydmas[100];
This is the struct & array.
Code:
gydytojas pgyd;
pgyd.vardas[25]=Edit21->Text;
pgyd.pavarde[35]=Edit22->Text;
pgyd.adresas[50]=Edit24->Text;
pgyd.asmkod=StrToInt(Edit23->Text);
pgyd.amzius=StrToInt(Edit27->Text);
pgyd.gydid=StrToInt(Edit26->Text);
pgyd.telefonas=StrToInt(Edit25->Text);
pgyd.specialyb=ComboBox5->ItemIndex;
gydmas[1]=pgyd;
ofstream fr("Gydytojai.inf");
for( int i = 1; i<2; i++) { fr << gydmas[i];}
fr.close();
(This is the creation of that file also, later i will ned to read and add the right number of array..)
I want to save an array to one file without using SaveDialog / OpenDialog( i can't choose file from which i could read/save so no printf, scanf could be used) , and would like to read from that file data.
As you see i tried to use ofstream, but there was an error :
[C++ Error] Unit1.cpp(180): E2094 'operator<<' not implemented in type 'ofstream' for arguments of type 'TForm1::gydytojas'