求用system.io.stream读取d:\\abc.txt的前10个字节的例子。 构造函数怎么写?读写参数设置该怎么设置? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 前十个字节还是字符?前十个字符这样 StreamReader stream = new StreamReader("d:\\abc.txt"); char[] buffer = null; stream.Read(buffer, 0, 10); using(FileStream fs = File.Open(@"d:\abc.txt")){ byte[] buff = new byte[10]; fs.Read(buff,0,buff.Length);} 不能直接用stream吗?必须用StreamReader吗? 可以啊, Stream s = new MemoryStream(); byte[] bytes = new byte[s.Length]; int n = s.Read(bytes,0, 10);具体MSDN:http://msdn.microsoft.com/zh-cn/library/system.io.stream.read.aspx 这个Stream s = new MemoryStream();是读取内存的吧?能读取文件吗? Stream s = new StreamReader(@"C:\1.txt").BaseStream; byte[] bytes = new byte[s.Length]; int n = s.Read(bytes, 0, 10); 帮忙获取webbrowser里的button元素 关于DataGridViewComboBoxColumn,添加 未序列化的问题? 关于上传文件的问题 为什么IEcache中会有两个完全一样的dll? C#的XmlDocument使用XPath时不支持带 命名空间 的XML文件么? 请教高手 请问谁知道在VB中的isdate和isnumeric函数在C#中怎样表示? 在线等待,装C#对机器的要求? 如何发送键盘事件???????? RichtextBox控件添加右键事件 实现复制 粘贴 剪切图片!是图片!! 关于属性与索引器问题。。
char[] buffer = null;
stream.Read(buffer, 0, 10);
{
byte[] buff = new byte[10];
fs.Read(buff,0,buff.Length);
}
byte[] bytes = new byte[s.Length];
int n = s.Read(bytes,0, 10);具体MSDN:http://msdn.microsoft.com/zh-cn/library/system.io.stream.read.aspx
Stream s = new StreamReader(@"C:\1.txt").BaseStream;
byte[] bytes = new byte[s.Length];
int n = s.Read(bytes, 0, 10);