How to assign Stream object to function
I am trying to use the StarkSoft.Ftp library, i have it all working but want to store the retrieved file to a Stream object for use in my application, i am quite new to streams so was hoping for some advice? Here is the function
Retrieves a remote file from the FTP server and writes the data to a local stream object specfied in the outStream parameter.
public void GetFile( string remotePath, Stream outStream, bool restart )
Here is my code but the data isnt put into stream 开发者_JS百科object i specify
Stream stream0 = new MemoryStream(); ftp.GetFile(col[0].Name, stream0, true);
Any pointers?
Tony
You have to set the stream's position to the beginning in order to read it:
stream0.Seek(0, SeekOrigin.Begin);
精彩评论