MFC problem with popen and update cedit

Hi!
I already post my problem at the german cpp forum, but nobody could help. I think this is one more proof that the german are not as good in programming as in conceiving cars ;) my problem is quite simple.
Im trying to read the output of an console application and transmit it in realtime to an CEdit. It dont work, The text is not displayed until the console app is done, and i dont get why! Can anybody help?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void CtestDlg::OnBnClickedOk()
{
	FILE *in;
	char buff[512];

	if(!(in = _popen("\"c:\\users\\admin\\documents\\visual studio 2010\\projects\\out\\debug\\out.exe\"", "r")))
	{
		// fehler
	}
	else
	{
		m_out.SetWindowTextW(_T("start..."));
		m_out.RedrawWindow();

		while(fgets(buff, 512, in))
		{
			m_out.SetSel(MAXLONG,MAXLONG);
			m_out.ReplaceSel(CString(buff));

			if (!AfxGetThread()->PumpMessage()) return;	
		}
	}
	_pclose(in);
}
popen on Windows?
Yes, popen it is emulated inside CRT using pipes ...

However, the problem is with buffering inside child process, not sure how to get rid of it without original source code .
Topic archived. No new replies allowed.