Q: Binary Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello group,

I have a binary file that I have to read and then supply data to a client
application in readable ASCII text for storage in the database. For
instance, if the first 10 bytes of a file are:
|1|2|3|4|5|6|7|8|9|9|...

Can I turn that into a 10-character string "1234567899" without reading the
stream for 10 bytes and appending each byte into a string variable? And if
so, how?

Thanks for any light you can shed on this problem.
Richard
 
Richard J said:
I have a binary file that I have to read and then supply data to a client
application in readable ASCII text for storage in the database. For
instance, if the first 10 bytes of a file are:
|1|2|3|4|5|6|7|8|9|9|...

Can I turn that into a 10-character string "1234567899" without reading the
stream for 10 bytes and appending each byte into a string variable? And if
so, how?

The most common way of turning arbitrary binary data into ASCII text is
to use Base64. You can stream this using the crypto transforms
"ToBase64Transform" and "FromBase64Transform".
 
Back
Top