Click here to Skip to main content
15,904,823 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Very very stupid question Pin
John R. Shaw29-Jul-05 13:48
John R. Shaw29-Jul-05 13:48 
GeneralRe: Very very stupid question Pin
Toby Opferman29-Jul-05 14:00
Toby Opferman29-Jul-05 14:00 
GeneralRe: Very very stupid question Pin
John R. Shaw29-Jul-05 14:20
John R. Shaw29-Jul-05 14:20 
GeneralRe: Very very stupid question Pin
ThaSaVa30-Jul-05 0:01
ThaSaVa30-Jul-05 0:01 
GeneralRe: Very very stupid question Pin
Lampros Giampouras30-Jul-05 2:48
Lampros Giampouras30-Jul-05 2:48 
Generallocalizing problem Pin
Razi Al-Sayed29-Jul-05 9:53
Razi Al-Sayed29-Jul-05 9:53 
GeneralRe: localizing problem Pin
Michael Dunn29-Jul-05 19:09
sitebuilderMichael Dunn29-Jul-05 19:09 
Questioncomport; never reaches EOF? Pin
quarry_0629-Jul-05 9:15
quarry_0629-Jul-05 9:15 
Problem Solved. I was looking for the wrong EOF sign.

I have a while loop
bool fContinue = true;<br />
	do<br />
	{<br />
		// Wait for an event<br />
		lLastError = serial.WaitEvent();<br />

Inside this loop, I receive data and process it.
<br />
if (eEvent & CSerial::EEventRecv)<br />
		{<br />
			// Read data, until there is nothing left<br />
			DWORD dwBytesRead = 0;<br />
			char szBuffer[101];<br />
			do<br />
			{<br />
				// Read data from the COM-port<br />
				lLastError = serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);<br />
				if (lLastError != ERROR_SUCCESS)<br />
					return ::ShowError(serial.GetLastError(), _T("Unable to read from COM-port."));<br />
<br />
				if (dwBytesRead > 0)<br />
				{<br />
					// Finalize the data, so it is a valid string<br />
					szBuffer[dwBytesRead] = '\0';<br />
<br />
					// Display the data<br />
					printf("%s", szBuffer);<br />
					write2file(szBuffer);<br />
					<br />
					// Check if EOF (CTRL+'[') has been specified<br />
					if (strchr(szBuffer,EOF_Char))<br />
						fContinue = false;<br />
				}<br />
			}<br />
		    while (dwBytesRead == sizeof(szBuffer)-1);<br />
                   }<br />
	}<br />
while (fContinue);<br />


now what happens, that it somehow never sets fContinue to false.
but the first function I call, serial.WaitEvent();, doesn't get something either, and I can see that in fact all the expected data has arrived. Is it that code running on the other side of the comport does not send the proper EOF? or what could it be?

thanks for any suggestions
QuestionMFC Dll in non-MFC app? Pin
Anacreon29-Jul-05 7:55
Anacreon29-Jul-05 7:55 
AnswerOne other note Pin
Anacreon29-Jul-05 8:25
Anacreon29-Jul-05 8:25 
AnswerRe: MFC Dll in non-MFC app? Pin
Michael Dunn29-Jul-05 9:46
sitebuilderMichael Dunn29-Jul-05 9:46 
GeneralRe: MFC Dll in non-MFC app? Pin
Anacreon29-Jul-05 10:07
Anacreon29-Jul-05 10:07 
GeneralRe: MFC Dll in non-MFC app? Pin
Anacreon29-Jul-05 10:27
Anacreon29-Jul-05 10:27 
GeneralRe: MFC Dll in non-MFC app? Pin
Anacreon29-Jul-05 10:44
Anacreon29-Jul-05 10:44 
General#include problem Pin
massad29-Jul-05 6:03
massad29-Jul-05 6:03 
GeneralRe: #include problem Pin
John R. Shaw29-Jul-05 6:36
John R. Shaw29-Jul-05 6:36 
GeneralRe: #include problem Pin
massad29-Jul-05 6:50
massad29-Jul-05 6:50 
GeneralRe: #include problem Pin
John R. Shaw29-Jul-05 7:07
John R. Shaw29-Jul-05 7:07 
GeneralRe: #include problem Pin
Bob Stanneveld29-Jul-05 7:41
Bob Stanneveld29-Jul-05 7:41 
GeneralRe: #include problem Pin
Anacreon29-Jul-05 7:58
Anacreon29-Jul-05 7:58 
GeneralRe: #include problem Pin
David Crow29-Jul-05 8:26
David Crow29-Jul-05 8:26 
GeneralRe: #include problem Pin
sunit529-Jul-05 20:48
sunit529-Jul-05 20:48 
QuestionVC++ 2003 NET apps without NET installed? Pin
gunrunnerjohn29-Jul-05 5:16
gunrunnerjohn29-Jul-05 5:16 
AnswerRe: VC++ 2003 NET apps without NET installed? Pin
S. Senthil Kumar29-Jul-05 5:22
S. Senthil Kumar29-Jul-05 5:22 
GeneralRe: VC++ 2003 NET apps without NET installed? Pin
gunrunnerjohn29-Jul-05 5:40
gunrunnerjohn29-Jul-05 5:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.