Raghavendra Joshi

Raghavendra Joshi

  • NA
  • 44
  • 46.8k

FileStream and stream object

Apr 28 2015 4:14 AM
I want to write the contents of one docx file to another using "FILESTREAM AND STREAM" OBJECT
Here is my code
HttpWebResponse r = (HttpWebResponse)w.GetResponse(); 
Stream objStream = r.GetResponseStream();
using (FileStream objStr = new FileStream(@"E:\downloads\test.docx", FileMode.Create))
{
Stream str = r.GetResponseStream();
if (str != null)
{
byte[] read = new byte[256];
long count = str.Read(read, 0, 256);
while (count > 0)
{
objStr.Write(read, 0, Convert.ToInt32(count));
count = str.Read(read, 0, 256);
}
}

str.close();
}
 

Answers (3)