R
reyalp
I use C++ Builder to create a simple project that can open a picture
and save some text information to a file
My question is that:
After I execute the open picture dialog(btn_OpenPicture) and open the
picture in the form, the write to file function(btn_SaveClick) doesn't
work anymore. Every time I click the save button, nothing changed in
the file.
But before the execution of open picture, it works normally.
Why does that happen? thanks
My code:
void __fastcall TForm1::btn_SaveClick(TObject *Sender)
{
int i;
double num[49];
ofstream outfile("Data.txt", ios_base::app);
if (!outfile)
return;
i = 20;
outfile << i << endl;
for (i = 0; i < 49; i++)
outfile << num << " ";
outfile << endl;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btn_OpenPictureClick(TObject *Sender)
{
OpenPictureDialog1->Execute();
Image1->Picture->LoadFromFile(OpenPictureDialog1-
//---------------------------------------------------------------------------
and save some text information to a file
My question is that:
After I execute the open picture dialog(btn_OpenPicture) and open the
picture in the form, the write to file function(btn_SaveClick) doesn't
work anymore. Every time I click the save button, nothing changed in
the file.
But before the execution of open picture, it works normally.
Why does that happen? thanks
My code:
void __fastcall TForm1::btn_SaveClick(TObject *Sender)
{
int i;
double num[49];
ofstream outfile("Data.txt", ios_base::app);
if (!outfile)
return;
i = 20;
outfile << i << endl;
for (i = 0; i < 49; i++)
outfile << num << " ";
outfile << endl;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btn_OpenPictureClick(TObject *Sender)
{
OpenPictureDialog1->Execute();
Image1->Picture->LoadFromFile(OpenPictureDialog1-
}FileName);
//---------------------------------------------------------------------------