Trying to extract data from IMemoryBlobStream

335
1
06-25-2017 10:34 PM
New Contributor III

Can someone tell me what I'm doing wrong here:

            byte[] inBytes = File.ReadAllBytes("c:\\temp\\NotesRecording.wav");
            IMemoryBlobStream inBlob = new MemoryBlobStreamClass();
            inBlob.ImportFromMemory(ref inBytes[0], (uint)inBytes.Length);
            MessageBox.Show(inBlob.Size.ToString());
            inBlob.SaveToFile("c:\\temp\\blobTest2.wav");
            byte[] outBytes = new byte[inBytes.Length];
            inBlob.AttachToMemory(ref outBytes[0], inBlob.Size, 0);

The last part is the problem, I'm trying to extract the data in the blob stream class to a byte array. It doesn't work at all though, the array just remain empty afterwards.

Reply
0 Kudos
1 Reply
New Contributor III

I found a work around. The IMemoryBlobStreamVariant interface lets you read and write the blob data to a byte array.

Reply
0 Kudos