本文介绍了在使用Readfile()读取串行端口时需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正尝试使用Windows API读取串行端口数据,但不知何故我无法正确读取串行端口..有人可以请帮忙.谢谢
这是我读取串口的代码
i was trying to read a serial port data by using windows api but somehow i could not able to read the serial port properly.. would anyone kindly please help. thanks
this is my code for the reading of the serial port
//***************Read Operation******************//
buffRead = 0;
dwBytesRead = 0;
int nread =20;
if (!ReadFile(hSerial, buffRead, nread, &dwBytesRead, NULL))
{
printf("error reading from input buffer \n");
}
printf("Data read from read buffer is \n %s \n",buffRead);
谢谢
kevin
thanks
kevin
推荐答案
这篇关于在使用Readfile()读取串行端口时需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!