How can i convert File to Binary? I just need it for my project. I need to encrypt a file by its binaries.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re referring to accessing the ACTUAL BINARY form then read in the file and convert every byte to a binary representation…
EDIT:
Here’s some code to convert a byte into a string with the bits:
If you’re referring to accessing the bytes in the file then simply use the following code (you can use this for the first case as well):
To use these two pieces of code you can now loop over every byte and create a String object (8X larger than the original file size!!) with the bits: