-
Weird Problem
Hi all,
Code:
#include "stdafx.h"
#include "Asimulator.h"
#include "inputBoxAP.h"
#include <cstring>
#include <fstream>
// inputBoxAP dialog
IMPLEMENT_DYNAMIC(inputBoxAP, CDialog)
inputBoxAP::inputBoxAP(CWnd* pParent /*=NULL*/)
: CDialog(inputBoxAP::IDD, pParent)
, amtAP(0)
{
}
inputBoxAP::~inputBoxAP()
{
}
void inputBoxAP::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, amtAP);
DDV_MinMaxInt(pDX, amtAP, 3, 5);
}
BEGIN_MESSAGE_MAP(inputBoxAP, CDialog)
ON_EN_CHANGE(IDC_EDIT1, &inputBoxAP::OnEnChangeEdit1)
ON_EN_UPDATE(IDC_EDIT1, &inputBoxAP::OnEnUpdateEdit1)
ON_BN_CLICKED(IDOK, &inputBoxAP::OnBnClickedOk)
END_MESSAGE_MAP()
// inputBoxAP message handlers -- The most imprt handler is OnBnClickedOK(), the rest don't care
void inputBoxAP::OnEnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void inputBoxAP::OnEnUpdateEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_UPDATE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void inputBoxAP::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
OnOK();
ofstream inputdata; < -- ERROR HERE
// To test if the operation is functioning correctly
CString temp;
temp.Format(_T("%d"),amtAP);
AfxMessageBox(temp);
}
Notice that at the last function, i include ofstream inputdata, but there is always an error produced:
ofstream undeclare identifier.
What is wrong here?
-
Re: Weird Problem
ofstream is inside of namespace std. Use it like this