开发者

Access LPT in C++

开发者 https://www.devze.com 2023-03-21 12:39 出处:网络
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 CreateFi

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

精彩评论

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