How to access LPT port in C++ visual express?开发者_如何转开发 I've read about including io.dll but I don't know how to use it. Could someone show me a simple code for doing it?
You can use CreateFile() to open an I/O device such as a printer port.
hLPT = CreateFile(
"LPT1",
GENERIC_WRITE,
0,
0,
CREATE_ALWAYS,
FILE_FLAG_NO_BUFFERING,
0);
WriteFile(
hLPT,
pointerToBuffer,
sizeOfBuffer,
&numberOfBytesWritten,
NULL);
FlushFileBuffers(hLPT);
精彩评论