如何在串行端口通信中读取Null [英] How to read Null in Serialport Communication

查看:119
本文介绍了如何在串行端口通信中读取Null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,
在我的VB应用程序中,我需要读取空值....
因为null之后,我得到了数据...但是由于null之后,我的数据已经终止了...现在我应该如何读取包括null的数据.......

在ADV中感谢

Hai All,
In my VB Application i need to read null value....
Because after of null i get data ..... But because of null my data has been terminated ... Now how should i read data including null.......

Thanks in ADV

推荐答案

null就是字节值0,无非.因此,在读取后扫描缓冲区并查找0.空.

当然,除非您要处理Unicode字符串,否则在这种情况下,它是连续两个0值.
A null is nothing but a byte value of 0. So, scan your buffer after the read and look for a 0. There''s your null.

Unless, of course, youre dealing with Unicode strings, in which case, it''s two 0 values in a row.


请参阅我对问题的评论.使用该端口,您可以传输字节,仅此而已.它应该使答案显而易见...

—SA
Please see my comment to the question. With the port, you transmit bytes, nothing else. It should make the answer apparent…

—SA


这篇关于如何在串行端口通信中读取Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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