流的位置指针会导致问题 [英] Position pointer of a stream causes problems

查看:74
本文介绍了流的位置指针会导致问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我为语音识别引擎提供了一个MemoryStream,但是如果无法识别该流.

I gave a MemoryStream to the Speech Recognition Engine, but if fails to recognize the stream.

问题是在语音识别访问流时写入流,我认为位置指针存在一些问题.指针当然在流的末尾,因此识别引擎认为没有什么可读取的.

The problem is that the stream is written while the speech recognition accesses it, I think there is some problem with the position pointer. The pointer is, of course, at the end of the stream, so the recognition engine thinks there is nothing to read.

唯一的解决方案是编写一个从流类派生的新类,该类具有两个单独的位置指针.一种用于写作,一种用于阅读.

The only solution can image is to write a new class derived from the stream class which has two separate position pointers. One for the writing and one for the reading.

还有其他解决方法吗?

此致

VoodooCode

VoodooCode

推荐答案

设置为

Set set the MemoryStream.Position to 0 before passing it to the SRE.

MemoryStream支持搜索,因此您可以随时更改位置.

MemoryStream supports seeking, so you can change the position at any time.


这篇关于流的位置指针会导致问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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