这是我的代码我试图从网址制作一个流,我想将文件切成6块并下载,因为我想将流连接到文件信息但是我遇到了一些错误。谢谢
FileInfo fs;
DateTime startTime = DateTime.UtcNow;
WebRequest request = WebRequest.Create("http://tegos.ru/new/mp3_full/David_Guetta_feat_Ne-Yo_and_Akon_-_Play_Hard.mp3");
WebResponse response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream())
using (Stream fileStream = fs new FileInfo("")))
错误'System.IO.FileInfo'是'type',但用作'变量'
答案 0 :(得分:0)
假设您要将HTTP响应中的流复制到文件中:
using (Stream output = File.OpenWrite("pah_to_file"))
{
using (Stream input = http.Response.GetResponseStream())
{
byte[] buffer = new byte[2048]; // some buffer
int bytesRead;
while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, bytesRead);
}
}
}
如果情况并非如此,请重新解释您的问题。