Click here to Skip to main content
16,004,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Can I Read File As Binary And Covert It To String And Save It To txt file the read string as Binary then as file ?
Posted

1 solution

You can read and write data as binary very easily:
VB
Dim data As Byte() = File.ReadAllBytes(path)
...
File.WriteAllBytes(path, data)
The problem is converting it to a string requires a little more knowledge: specifically the format of the data you are reading and the format you want to use as a string. Bytes are 8 bit hex values, but strings are made of characters - which are 16 bit Unicode values for the most part, and it may not just be a case of "read bytes, treat as characters" - the results you get as a string or text file may not be what you expect, or even readable.


Do you have any idea what the binary data is? And how you want to store it?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900