Code:
class RecAdj
{
public:
RecAdj();
char m_invoice_c11[11];
void ReadRec(int number, CListBox* pListBox);
void SaveRecItem(CString filename);
};
void CRegisterDoc::OnReceive()
{
// TODO: Add your command handler code here
VendorDlg adlg;
if(adlg.DoModal() == IDOK)
{
RecItemdlg recdlg;
do
{
//adlg.m_invoicenumber is a CString its value here would ex. "Bob" with no spaces.
strcpy(recdlg.recitem.m_invoice_c11 , adlg.m_invoicenumber);
}while(recdlg.DoModal()==IDOK);
}//endif
}
void RecAdj::SaveRecItem(CString filename)
{
std::ofstream fout(filename, std::ios::binary | std::ios::app);
if(fout.fail())
AfxMessageBox("Temp rec file failed to open", MB_OK);
else
{
fout.write(m_invoice_c11, sizeof(m_invoice_c11)); //as is "Bob........" is the output
}
fout.close();
}
the above is the acutall code minus the call funtion to SaveRecItem. Its called from another function but doesn't change or affect the data in anyway. I have stripped this down to be only one variable, in the actual code there are lots more.