想学习利用vc进行计算机串口或者usb口与外部通讯的知识,应该看哪一部分?
期待指教中~~
推荐阅读
串口的话,vc中有现成的类,好像是cserial,
我这里有个写好的类
头文件是
// serial.h
#ifndef __serial_h__
#define __serial_h__
#define fc_dtrdsr 0x01
#define fc_rtscts 0x02
#define fc_xonxoff 0x04
#define ascii_bel 0x07
#define ascii_bs 0x08
#define ascii_lf 0x0a
#define ascii_cr 0x0d
#define ascii_xon 0x11
#define ascii_xoff 0x13
class cserial
{
public:
cserial();
~cserial();
bool open( int nport = 2, int nbaud = 9600 );
bool close( void );
int readdata( void *, int );
int senddata( const char *, int );
int readdatawaiting( void );
bool isopened( void ){ return( m_bopened ); }
protected:
bool writecommbyte( unsigned char );
handle m_hidcomdev;
overlapped m_overlappedread, m_overlappedwrite;
bool m_bopened;
};
#endif


讨论区