Click here to Skip to main content
15,885,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
i want termite source code in c++ instead of c#.

please anyone help me in this matter.

What I have tried:

as i am using serial communication in vc++ i am getting 37 byte packet in 3 second and that is too much.
so i need help in this.
Posted
Updated 28-Jul-18 1:02am

1 solution

No.
Partly, we aren't here to do your job for you, but mostly we aren't a code translation service and didn't write Termite anyway.

And if you think that 37 bytes in three seconds is "too much" then you really need to brush up on serial coms...
 
Share this answer
 
Comments
Member 12533122 28-Jul-18 7:24am    
i am not telling you to do it for me.
as i am working on serial communication and as i am seeing data receiving is faster in termite but in my application i am getting 1 packet at 3 second. so i am asking for termite code or you can also help me in other ways.

i just want to read data faster.
any help will be helpfull to me
OriginalGriff 28-Jul-18 7:34am    
How do you expect us to help when we have no idea at all how your code works?
Member 12533122 28-Jul-18 7:36am    
BOOL bReadRC;
DWORD iBytesRead;
DWORD dwError;
unsigned char sBuffer[255];
char sMsg[512];

if(iVal == 0)
{
start = clock();
}

memset(sBuffer,0,sizeof(sBuffer));
bReadRC = ReadFile(handle_comm, &sBuffer, 255, &iBytesRead, NULL);

if (bReadRC && iBytesRead > 0)
{
itoa(sBuffer[iVal],sMsg,10);;
//printf("\n%d::%s",iVal,sMsg);
CString temp(sMsg);
iBuffer[iVal] = _wtoi(temp);
//printf("\n>>%d,",iBuffer[iVal]);
iVal++;

if(iVal == PACKET_SIZE)
{
iVal = 0;
//printf("\n");

unsigned int iTimeDiff = clock()-start;
printf("\niTimeDiff :: %d",iTimeDiff);
}
}

this is my code i have done reading like this
OriginalGriff 28-Jul-18 7:49am    
And it will be slow. Why? Because it's trying to read 255 bytes, and you are only getting 37 - so it's presumably timing out. Try reading one byte at a time and see what happens.
Member 12533122 28-Jul-18 7:53am    
this

bReadRC = ReadFile(handle_comm, &sBuffer, 255, &iBytesRead, NULL);

readfile function is already giving me one by one byte.

i am not getting whole packet at once . i am getting byte by byte.

so should i replace 255 to 1 ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900