Hi,
I have something strange going on with my file output function, everything seems correct, i've checked with all possible references on the topic, but it is not working, i.e. not doing anything, not even creating the file for output.
I'm using C++ Builder 6, and here is the code:
and the function is called from the form, like this:
Any ideas why this could be?
I have something strange going on with my file output function, everything seems correct, i've checked with all possible references on the topic, but it is not working, i.e. not doing anything, not even creating the file for output.
I'm using C++ Builder 6, and here is the code:
Code:
void Product :: OutputToFile()
{
fstream outputfile("data.txt", ios::app);
outputfile<<ProductName.c_str() << "\n"
<<ProductID<< "\n"
<< Weight<< "\n"
<< PriceWithoutVAT<< "\n"
<< PriceWithVAT<< "\n"
<< ExpiryDate.c_str()<< "\n"
<< AmountInStock<< "\n"
<< ReorderLimit<< "\n"
<< ProductCategory.c_str()<< "\n"
<< InputDate.c_str()<< "\n"
<< DueDate.c_str()<< "\n"
<< Manufacturer.c_str()<< "\n"
<< ManufacturerAddress.c_str()<< "\n";
outputfile.close();
}
Code:
void __fastcall TForm1::SaveToFileClick(TObject *Sender)
{
for(int i=0;i<size;i++)
{
myProductList.getProduct(i)->OutputToFile();
}
}
Comment