What is the Win32 command for writing to a com port handle??
Printable View
What is the Win32 command for writing to a com port handle??
There are examples on CodeGuru for Serial Port Communications.Code:
// Open Com Port
HANDLE _hSerialComm = CreateFile("\\\\.\\COM1",
GENERIC_READ|GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL |
FILE_FLAG_OVERLAPPED,
0);
// Read the Com Port
DWORD dwLength, cb;
OVERLAPPED _osSerial;
ReadFile(_hSerialComm,buffer,dwLength,&cb,&_osSerial);
// Write to Com Port
WriteFile(_hSerialComm, buffer, dwLength, &cb,&_osSerial);
createfile to get a handle
readfile to read from port
writefile to write to port
a very very very very very helpful tutorial:
http://www.daniweb.com/techtalkforum...ead.php?t=8020