Click here to Skip to main content
15,909,466 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalabout ie(on xp) and activex document Pin
William.Wang11-Jul-05 18:02
William.Wang11-Jul-05 18:02 
GeneralMS Flexi Grid Controls Pin
Nalima Banu11-Jul-05 17:46
Nalima Banu11-Jul-05 17:46 
GeneralMFC CString Question Pin
Stephen Doty11-Jul-05 17:32
Stephen Doty11-Jul-05 17:32 
GeneralRe: MFC CString Question Pin
Nish Nishant11-Jul-05 17:45
sitebuilderNish Nishant11-Jul-05 17:45 
GeneralRe: MFC CString Question Pin
Geert van Horrik11-Jul-05 23:52
Geert van Horrik11-Jul-05 23:52 
GeneralRe: MFC CString Question Pin
Stephen Doty12-Jul-05 6:50
Stephen Doty12-Jul-05 6:50 
GeneralRe: MFC CString Question Pin
Mister Transistor14-Jul-05 2:50
Mister Transistor14-Jul-05 2:50 
GeneralOptimizing Serial Read/Write Routines Pin
CNewbie11-Jul-05 16:33
CNewbie11-Jul-05 16:33 
Right now my Serial Library works. i can read/write correctly, However i do not think I am doing it optimally and I know that I am not doing it the overlapped way. So maybe you could help me to optimize my serial read/write function so that it is done correctly. Right now i am using a for loop to read X number of bytes from the port. Problem with this method is that it will loop forever if X # of bytes are never read.

What I want to be able to do is read from the port until there is no more bytes to read. That way i dont always need to know how many bytes I need to read and the read wont block the program flow indefinitely.

Below is a sample of how i would currently read from the port:

<br />
for( Size = 0; Size < 5 ; )                                 // Loop until 5 bytes have been read<br />
{                                                           //<br />
	ReadFile(hComm, &Buf, 1, &IncomingReadSize, NULL);  //Read 1 byte at a time<br />
	if(IncomingReadSize > 0)                            //If byte has been read continue<br />
	{<br />
		Size += IncomingReadSize;                   //Increment "bytes read" counter<br />
		packetbuf[x] = Buf;                         //put byte read into array<br />
		x++;                                        //increment array pointer<br />
	}<br />
}                                                           //else loop and try again<br />


This just seems horribly inefficient to me. Anyone else think so?
GeneralRe: Optimizing Serial Read/Write Routines Pin
Bob Stanneveld11-Jul-05 20:36
Bob Stanneveld11-Jul-05 20:36 
GeneralWrite a program that simulates the rolling of two dice. Pin
bartman143711-Jul-05 16:10
bartman143711-Jul-05 16:10 
GeneralRe: Write a program that simulates the rolling of two dice. Pin
Jose Lamas Rios11-Jul-05 16:29
Jose Lamas Rios11-Jul-05 16:29 
GeneralRe: Write a program that simulates the rolling of two dice. Pin
bartman143714-Jul-05 13:10
bartman143714-Jul-05 13:10 
GeneralRe: Write a program that simulates the rolling of two dice. Pin
Jose Lamas Rios14-Jul-05 17:08
Jose Lamas Rios14-Jul-05 17:08 
Generalone inportant thing Pin
LeeeNN11-Jul-05 14:40
LeeeNN11-Jul-05 14:40 
GeneralRe: one inportant thing Pin
Christian Graus11-Jul-05 16:58
protectorChristian Graus11-Jul-05 16:58 
GeneralRe: one inportant thing Pin
Weiye Chen11-Jul-05 17:28
Weiye Chen11-Jul-05 17:28 
GeneralRe: one inportant thing Pin
Christian Graus11-Jul-05 17:32
protectorChristian Graus11-Jul-05 17:32 
GeneralRe: one inportant thing Pin
Neelesh K J Jain11-Jul-05 20:10
Neelesh K J Jain11-Jul-05 20:10 
GeneralRe: one inportant thing Pin
Christian Graus12-Jul-05 13:10
protectorChristian Graus12-Jul-05 13:10 
GeneralRe: one inportant thing Pin
Bob Stanneveld11-Jul-05 20:38
Bob Stanneveld11-Jul-05 20:38 
GeneralRe: one inportant thing Pin
LeeeNN12-Jul-05 6:57
LeeeNN12-Jul-05 6:57 
GeneralCXX0017: Error: symbol &quot;buf_balance&quot; not found Pin
LeeeNN11-Jul-05 14:09
LeeeNN11-Jul-05 14:09 
GeneralRe: CXX0017: Error: symbol &quot;buf_balance&quot; not found Pin
Indivara11-Jul-05 14:28
professionalIndivara11-Jul-05 14:28 
GeneralRe: CXX0017: Error: symbol &quot;buf_balance&quot; not found Pin
Indivara11-Jul-05 18:19
professionalIndivara11-Jul-05 18:19 
GeneralRe: CXX0017: Error: symbol &quot;buf_balance&quot; not found Pin
Bob Stanneveld11-Jul-05 20:40
Bob Stanneveld11-Jul-05 20: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.