I tried to write a little commandline tool that converts a file to a base64
datastream.
The application that needs to work with these base64 files (MS Word 2003 in
XML) doesn't accept the resultfiles of my tool though.
When I compare my resultfile with a file that has been generated by Word I
can see that only the first 3 characters of the stream are different.
No matter what file I convert, my first 3 chars are always " 9/" while Word
always writes "/9j". All other chars are identical.
Is this somekind of header? Do I use an incorrect datatype?
Below is a code snippet which I use to convert the data. (I added the '
before each line to work around a paranoid virusscanner)
'Dim fsi As New System.IO.FileStream(file, IO.FileMode.Open)
'Dim fso As System.IO.FileStream
'Try
' fso = New System.IO.FileStream(fileNameOut, IO.FileMode.CreateNew)
'Catch e As Exception
' fso = New System.IO.FileStream(fileNameOut, IO.FileMode.Truncate)
'End Try
'Dim br As New System.IO.BinaryReader(fsi)
'Dim bw As New System.IO.BinaryWriter(fso)
'Dim targetString As String
'targetString = Convert.ToBase64String(br.ReadBytes(CInt(fi.Length ())))
'bw.Write(targetString)
'bw.Close()
'br.Close()
'fso.Close()
'fsi.Close()
Thanks in advance,
Romain