忽略控制台中的转义字符 [英] ignore escape character in console

查看:350
本文介绍了忽略控制台中的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i设计的应用程序从串口接收字符并在编辑控件中打印。这个功能正常工作但是每当收到转义字符时就像1B {2K \r}一样清除线和1B [2J \r]用于清除时间应用程序挂起的屏幕;如何管理此条件以持续从端口接收数据?

解决方案

错误的方法:而不是跳过逃生字符,找出应用程序挂起的原因并修复它的根本原因,这肯定与此字符没有直接关系。使用调试器。但是当你这样做时,在控件中显示之前清理所有数据。我不知道为什么它可能会导致任何编码问题。也许你需要展示你的代码示例并解释你的问题。 但只有在找出问题的根本原因时才这样做。



-SA

Hi,
i designed application which receives characters from serial port and print in edit control.This function working properly but whenever escape character received like 1B{2K\r} for clear line &1B[2J\r] for clear screen that time application hangs;how to manage this condition for continually data received from port?

解决方案

Wrong approach: instead of skipping of the escape character, find out why the application is hanging and fix the root cause of it, which certainly is not directly related with this character. Use the debugger. But when you do it, sanitize all data before showing it in the control. I have no idea why it could possibly cause any coding problem. Perhaps you would need to show your code sample and explain what is your concern. But do it only when you figure out the root cause of the problem.

—SA


这篇关于忽略控制台中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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