如何分块读取二进制文件

it_lwj 2006-12-12 11:45:06
我的功能是这样子的,getinfo.aspx?from=0&to=10&file=d:\12345.wmv,如果传这样的一个地址过去,我就能实现12345.wmv的文件0K读取10K,from和to这两个参数动态设置的,然后我在getinfo.aspx要输出两进制文件,请问那位高手会呀,帮帮忙。
...全文
386 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
nijiaze 2006-12-14
  • 打赏
  • 举报
回复
Q群 12757054 群主有请!
希望相关的.net开发者&&初学者家入(但是一定要经常的在线)
我要保证在线人数
能让大家的问题及时得到解决!
欢迎加入 共同进步!
hy98521 2006-12-14
  • 打赏
  • 举报
回复
那里开是读取
lostowner 2006-12-12
  • 打赏
  • 举报
回复
UP
zhaochong12 2006-12-12
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/TopicView3.asp?id=5117946
it_lwj 2006-12-12
  • 打赏
  • 举报
回复
fs.Seek( start , SeekOrigin.Begin );这句是什么意思那位知道呀
it_lwj 2006-12-12
  • 打赏
  • 举报
回复
int start = 0*1024;
int end = 10*1024;
string strfile = Request["file"];
FileStream fs=new FileStream (@"D:\free.rar",FileMode.Open );
fs.Seek( start , SeekOrigin.Begin );
byte[] bdate = new byte[end-start+1];
fs.Read( bdate , 0 , end-start+1 );
Response.BinaryWrite(bdate);
这样写对不对呀
it_lwj 2006-12-12
  • 打赏
  • 举报
回复
还在吗
孟子E章 2006-12-12
  • 打赏
  • 举报
回复
分段读取并下载的例子
http://support.microsoft.com/kb/812406/zh-cn
孟子E章 2006-12-12
  • 打赏
  • 举报
回复
分段读取得例子
http://support.microsoft.com/kb/812406/zh-cn
buyaowen 2006-12-12
  • 打赏
  • 举报
回复
mark
cancerser 2006-12-12
  • 打赏
  • 举报
回复
int iT=1024;
int ifrom=0,ito=10;//取了自己变
Stream s=File.Open(@"d:\12345.wmv",FileMode.Open);
s.Position=ifrom*iT;
int ilen=(ito-ifrom)*1024;
byte[] bT=new byte[ilen];
s.Read(bT,0,ilen);
Response.BinaryWrite(b);
//应该是这意思吧
lxhvc 2006-12-12
  • 打赏
  • 举报
回复
using System;
using System.IO;
class MyStream
{
private const string FILE_NAME = "Test.data";
public static void Main(String[] args)
{
// Create the new, empty data file.
if (File.Exists(FILE_NAME))
{
Console.WriteLine("{0} already exists!", FILE_NAME);
return;
}
FileStream fs = new FileStream(FILE_NAME, FileMode.CreateNew);
// Create the writer for data.
BinaryWriter w = new BinaryWriter(fs);
// Write data to Test.data.
for (int i = 0; i < 11; i++)
{
w.Write( (int) i);
}
w.Close();
fs.Close();
// Create the reader for data.
fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// Read data from Test.data.
for (int i = 0; i < 11; i++)
{
Console.WriteLine(r.ReadInt32());
}
r.Close();
fs.Close();
}
}
lxhvc 2006-12-12
  • 打赏
  • 举报
回复
using System;
using System.IO;
class MyStream
{
private const string FILE_NAME = "Test.data";
public static void Main(String[] args)
{
// Create the new, empty data file.
if (File.Exists(FILE_NAME))
{
Console.WriteLine("{0} already exists!", FILE_NAME);
return;
}
FileStream fs = new FileStream(FILE_NAME, FileMode.CreateNew);
// Create the writer for data.
BinaryWriter w = new BinaryWriter(fs);
// Write data to Test.data.
for (int i = 0; i < 11; i++)
{
w.Write( (int) i);
}
w.Close();
fs.Close();
// Create the reader for data.
fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// Read data from Test.data.
for (int i = 0; i < 11; i++)
{
Console.WriteLine(r.ReadInt32());
}
r.Close();
fs.Close();
}
}
it_lwj 2006-12-12
  • 打赏
  • 举报
回复
怎么都没人在呀
it_lwj 2006-12-12
  • 打赏
  • 举报
回复
怎么都没人在呀
jcyluck 2006-12-12
  • 打赏
  • 举报
回复

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧