C/C++ code#include
#include
int main(void)
{
int i,w;
char readBuffer[100];
char lpOutBuffer[6]={0x23,0x30,0x31,0x30,0x0d,0x0a};\\向串口发出的命令 输入#010---->返回(>+03.267)
DWORD dwBytesWrite=100;
COMSTAT ComStat;
DWORD dwErrorFlags;
TCHAR str[100];
DWORD nWantRead=100;
DWORD nReadRead;
//LPOVERLAPPED m_OverlappedRead;
int s;
DWORD i_size=1024;
DWORD o_size=1024;
HANDLE hCom=CreateFile("COM1",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hCom == INVALID_HANDLE_VALUE)
{
MessageBox(NULL,"打开串口失败!!","OK",MB_OK);
}
MessageBox(NULL,"打开串口成功!!","连接7017",MB_OK);
if(!SetupComm(hCom,1024,1024)) |