Click here to Skip to main content
15,896,207 members

Comments by Member 12330615 (Top 11 by date)

Member 12330615 10-Nov-17 0:46am View    
"Have you installed your service?"
I am sorry I don't understand this question mean....
Member 12330615 20-Oct-17 10:35am View    
I would like to know the last parameter of the following

ReadFile(hComm, &rx, 1, dwBytesTransferred, X); // <--- X

I guess that "X = null" mean waiting data from the serial port.
But I don't know the meaning of "X != null" and the usage of examples.

Please let me know the purpose of this and advise me the full usage of example as "X != null"
Member 12330615 20-Oct-17 1:40am View    
Deleted
I wrote some strange code like this:

unsigned char rx;
unsigned char c;
char SaveBuffer[32767];
BOOL SaveSW;

int i =0, k= -1;

for (;;)
{
r = 0; rx = 0;

if(!WaitCommEvent(hComm, &dwEventMask, NULL)) continue;

SetCommMask(hComm, EV_RXCHAR | EV_CTS | EV_DSR);

BOOL pass_flag = FALSE;

if(dwEventMask &= EV_RXCHAR)
while(!pass_flag)
{
ClearCommError(hComm, &dwErrors, &Stat);
if (!Stat.cbInQue) break;

else {
ReadFile(hComm, &rx, 1, dwBytesTransferred, 0); // <- look at this!!!
if(dwBytesTransferred == 1)
{
c = rx;
if( c == STX)
{
SaveSW = ON;
}
else if (c == ETX)
{
SaveSW = OFF;
}

if(SaveSW)
SaveBuffer[i++] = c;

.......

......
As shown above code,
I use unsigned char rx to receive data one by one.
If this problem from BUFFER_OVERRUN error,
how can I change the variable rx to any type?
As a novice of C++, it is another problem to me.

Thank you again...
Member 12330615 19-Jul-17 20:47pm View    
Omitting size parameter in the use of sprintf_s has no compile error, but make running error.
char a[8];
sprintf(a, "%07d", i); // this has no compile error. but it cause strange result.
Member 12330615 13-Jul-17 21:29pm View    
This file is a index file as the sequences are very important. So, a Logbuffer with 1000 sequential records. But in the multiple transactions, The indexes are broken(?) and filled with spaces and no CRLF when I see the file by "notepad".