如何让C ++从USB端口(如串行端口)执行I / O [英] How to get C++ to perform I/O from a USB Port like a Serial Port

查看:151
本文介绍了如何让C ++从USB端口(如串行端口)执行I / O的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从特定的USB端口读取/写入特定的USB端口,避免所有的USB握手内容?

Is it possible to read/write from/to a specific USB port, avoiding all that USB handshaking stuff?

我想做的就是与微控制器,例如,没有通过USB的板载USB驱动程序。我希望我的C ++应用程序能够通过特定的USB端口发送数据,然后从同一个USB端口接收数据。

What I want to do is communicate with a microcontroller, for example, that doesn't have a USB driver on board via USB. I want my C++ application to be able to send data via a specific USB port and then to receive data from that same USB port.

基本上我想要能够做是把USB端口看作一个串行端口。这可能吗?是否有解决方法我可以使用?

Basically what I want to be able to do is treat that USB port like a serial port. Is this possible? Is there a workaround I can use?

提前感谢。

PS:我知道这不是最好的办法是与uC通信,但让我们假设,由于某种原因,我必须这样做。

PS: I know this isn't the best way to go about communication with a uC, but let's assume, for some reason, I have to do it this way.

编辑:BTW我使用Windows 7

BTW I'm using Windows 7

推荐答案

使用其中一个USB串行端口适配器。 USB端口看起来就像是C ++程序的串口。

Use one of the USB to serial port adapters. The USB port will look just like a serial port to your C++ program.

这篇关于如何让C ++从USB端口(如串行端口)执行I / O的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆