class save_Text
{
private:
char** buff;
int l_size;
char* name;
ofstream my_File;
UnicodeString* date;
const int length=256;
public:
save_Text(char* file_Name,UnicodeString* text,int lines);
void Save();
~save_Text();
};
save_Text::save_Text(char* file_Name,UnicodeString* text,int lines)
{
l_size=lines;
name=file_Name;
date=text;
buff=new char*[l_size];
for(int i=0;i<l_size;i++)
buff[i]=new char[length];
}
void save_Text::Save()
{
my_File.open(name);
for(int i=0;i<l_size;i++)
{
wcstombs(buff[i],date[i].w_str(),length);
my_File<<buff[i]<<"\n";
}
my_File.close();
}
save_Text::~save_Text()
{
for(int i=0;i<l_size;i++)
delete [] buff[i];
delete []buff;
}
void __fastcall TForm1::Button3Click(TObject *Sender)
{
UnicodeString safety_Tips[5];
safety_Tips[0]="Report to Safety Cordinator";
safety_Tips[1]="Stricty obey Safety Rules";
safety_Tips[2]="Smoke only in designated areas";
safety_Tips[3]="Keep Emergency Number near you";
safety_Tips[4]="Do not take risks";
save_Text Safety("safety.txt",safety_Tips,5);
Safety.Save();
}