How to open COMXX files(serial port)(如何打开 COMXX 文件(串口))
问题描述
我的串口有问题.
我写了一个程序,可以读取端口 COM1 到 COM9,但可以打开 COMXX(如 com10、com11 等)
I've written a program that can read ports COM1 to COM9, but can open COMXX(like com10, com11, etc.)
我已经搜索并了解到 tCOM1–COM9 是 NT 命名空间中保留名称的一部分.它说要访问像 COMXX 这样的文件,您需要编写.COMXX".
I've searched and learnt that tCOM1–COM9 are part of the reserved names in the NT namespaces. it says that "To acces files like COMXX you need to write ".COMXX".
我试过了,但没有成功.
I've tried this, but didn't make it.
有人有想法吗?我最好的问候...
Does anybody have an idea? My best regards...
因为这个问题,下面的代码返回了一个无效的句柄值:
推荐答案
需要转义文件名参数中的反斜杠:
You need to escape the backslashes in the filename parameter:
您还试图打开 COM 端口 14.您的机器上真的有 14 个 COM 端口吗?试试 COM1
.
You're also trying to open COM port 14. Do you really have 14 COM ports on your machine? Try COM1
instead.
这篇关于如何打开 COMXX 文件(串口)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!