开发者

Access LPT in C++

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜