How to write a huge stream to a file?

  • Thread starter Thread starter Rudy Ko
  • Start date Start date
R

Rudy Ko

All,

I want to write a big binary stream that was getting from
WebResponse.GetResponseStream() to a file. Anyone can help?

Thanks,
Rudy
 
Rudy Ko said:
I want to write a big binary stream that was getting from
WebResponse.GetResponseStream() to a file. Anyone can help?

Sure. Open the stream to write to, and then just read blocks at a time
out of GetResponseStream, writing them to the output stream. Stop when
Read returns a value <= 0. Note that you must only write out the number
of bytes read at any one time - don't assume that the buffer will have
been filled.
 
Back
Top