如何清除串口缓冲区? [英] How to clear the serial port buffer?

查看:419
本文介绍了如何清除串口缓冲区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:)
我正在用C ++/CLI编写应用程序,但是串行传输有问题.在开始时,我得到了一些其他数据,这些数据不应该存在.我正在使用SerialPort类.传输开始之前,可能应清除缓冲区. DiscardOutBuffer()与C中的fflush()类似吗?

Hi All :)
I''m writing an application in C++/CLI and I have a problem with serial transmission. At the beggining, I got some additional data, which are not supposed to be there. I''m using SerialPort class. Probably buffer should be cleared before the transimission starts. Does DiscardOutBuffer() work similar to fflush() in C? Can you please give me any advice?

推荐答案

^ ],我不会.




此链接将为您提供帮助

< a href ="http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/"> http://www.tech-forums.net /pc/f11/flush-serial-port-read-buffer-c-226473/</a> [< a href ="http://www.tech-forums.net/pc/f11/flush-serial -port-read-buffer-c-226473/"target =" _ blank"title =" New Window> ^</a>]
Hi,

This link will help you

<a href="http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/">http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/</a>[<a href="http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/" target="_blank" title="New Window">^</a>]


尝试使用PurgeComm API.

供您参考:
http://www.codeguru.com/cpp/in/network/serialcommunications/article. php/c2503 [ ^ ]

最好的问候!
Try using the PurgeComm API.

For your reference:
http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c2503[^]

Best regards!


这篇关于如何清除串口缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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