1

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?

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
Bozik1
  • 11
  • 2

1 Answers1

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