I am trying to output a string to a binary file, but I have no idea how to do it at all
say if I have a string:
string A = "1010";
I want to output it as a byte to the binary file
and I need to format it as 00001010
I guess I need to extract it bit by bit from the string and somehow using bit operator to assign the bit to the byte, then output the byte to the binary file
But I can't find any reference on the web about that
Does anyone know how and give me an example of it?
Also, do I need to output it byte by byte to the binary file?
If I want to read a binary file and convert it back to a string or a character, how can I do it?