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?
Asked
Active
Viewed 2,029 times
1
-
1Use inpout32.dll to bypass the I/O restrictions. Take the first google hit. – Hans Passant Jul 19 '11 at 09:31
1 Answers
2
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);

Captain Obvlious
- 19,754
- 5
- 44
- 74