Trying to extract data from IMemoryBlobStream

720
1
06-25-2017 10:34 PM
AllanMills
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.

0 Kudos
1 Reply
AllanMills
New Contributor III

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

0 Kudos