I am a new comer in MFC programming. I have already wrote a program, and I want to display the program in a graphical interface. So I use MFC dialog to realize it, but it does not work when runs.
Once the OK button is clicked :
void CTest1Dlg::OnBnClickedOk()
{
UpdateData();
FILE *stream;
freopen_s( &stream, "out_file.ps", "w", stdout ); // reopen stream as .ps
if (mode == 1) //main() in my code
{
ActiveAuthoring();
}
else if (mode == 0)
{
XYAuthoring();
}
else
{
ActiveAuthoring();
}
cout<<"showpage"<<endl;
UpdateData(FALSE);
OnOK();
}
My code is in converter.cpp, so first I change converter.cpp to converter.h and include it in Test1Dlg.cpp. And then when the OK button click run the main() in my code.
However, I discover that it seems the parameter does not transfer from the graphical interface to my code, although I relevant the edit control box to every parameter. So the dialog does not work. Could some one help me?
EDIT

The eight edit control boxes are the parameters I used in my coverter.cpp.
My code is aim to use eight parameters to generate some strings, these strings are saved in a file named as out_file which format is .ps.
stdout"? Do you mean to write to console? I think MFC cannot directly write to console. Something likeAttachConsolehas to be called. - raj raj