Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 C++ Visual Express 中访问 LPT 端口?我已经阅读了有关包含 io.dll 的信息,但我不知道如何使用它。有人可以给我看一个简单的代码吗?
您可以使用 CreateFile() 打开 I/O 设备,例如打印机端口。
hLPT = CreateFile( "LPT1", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_FLAG_NO_BUFFERING, 0); WriteFile( hLPT, pointerToBuffer, sizeOfBuffer, &numberOfBytesWritten, NULL); FlushFileBuffers(hLPT);