我想使用FileStream对象从网络上的不同文件读取数据。 所以我创建了任务(System.Threading.Tasks)来读取所需的部分文件。System.Threading.Tasks和FileStream
相当惊讶的行为。这些任务将引发一个错误:
int_ReadBytes = stm_BaseStream.Read (byt_buffer, 0, (int) (int_RecordLength * uint_BufferThis));
if (int_ReadBytes != (int_RecordLength * uint_BufferThis))
{
throw new Exception ("Could not read record");
// throws an error here.
}
人使用任务使用FileStream对象,或有任何想法,为什么我得到这个问题? 谢谢。
你在任务中声明了stm_BaseStream吗? – 2011-04-20 09:00:39
也许你在文件的末尾? – 321X 2011-04-20 09:01:23
错误信息是什么? – 2011-04-20 09:01:56