标题:filestream的一个问题
取消只看楼主
cpxuvs
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:45
专家分:142
注 册:2015-12-22
结帖率:85.71%
已结贴  问题点数:20 回复次数:1 
filestream的一个问题
在书上看到一段代码
程序代码:
filestream filestream=new FileStream(Path,FileAccess.Read);
            int number;
            byte[] bye=new byte[8];
            NetworkStream stream=new NetworkStream(mysock);
            while((number=filestream.Read(bye,0,8))!=0)
            {
                stream.Write(bye,0,8);
                stream.Flush();
                bye=new byte[8];
            }
请问为什么while里面还要弄个byte数组?我觉得不需要,是不是写错了?
搜索更多相关主题的帖子: number stream color 
2016-05-22 13:42
cpxuvs
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:45
专家分:142
注 册:2015-12-22
得分:0 
懂了,谢谢。最后的数据没有新数据覆盖,如果不清空,会导致重复写入。是这个意思吧
2016-05-23 12:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465123-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.561986 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved