Stream Write Problems
-
I have a memorystream full of data. I try and use the MemoryStream.Write(byte[],0,MemoryStream.Length) and it fills my byte array up with all zero's almost like it never copied. I can verify there is data in the MemoryStream. The position of the memory stream is at 0 so that's not it.... Can anyone help me? I just don't get it. Thanks very much, Steve Nelson
-
I have a memorystream full of data. I try and use the MemoryStream.Write(byte[],0,MemoryStream.Length) and it fills my byte array up with all zero's almost like it never copied. I can verify there is data in the MemoryStream. The position of the memory stream is at 0 so that's not it.... Can anyone help me? I just don't get it. Thanks very much, Steve Nelson
-
I have a memorystream full of data. I try and use the MemoryStream.Write(byte[],0,MemoryStream.Length) and it fills my byte array up with all zero's almost like it never copied. I can verify there is data in the MemoryStream. The position of the memory stream is at 0 so that's not it.... Can anyone help me? I just don't get it. Thanks very much, Steve Nelson
Write(byte[] buffer, int offset, int count)
Writes a block of bytes to the current stream using data read from buffer.Read(byte[] buffer, int offset, int count)
Reads a block of bytes from the current stream and writes the data to buffer. Your code is copying the contents of the buffer - which will be zero - to the stream. It sounds like you want to copy the contents of the stream to the buffer, in which case you need to use theRead
method.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Write(byte[] buffer, int offset, int count)
Writes a block of bytes to the current stream using data read from buffer.Read(byte[] buffer, int offset, int count)
Reads a block of bytes from the current stream and writes the data to buffer. Your code is copying the contents of the buffer - which will be zero - to the stream. It sounds like you want to copy the contents of the stream to the buffer, in which case you need to use theRead
method.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer