Breaking a binary stream
I am new to programming, I have a task which I have to do the following
1. I have to read in a text file containing characters as well as space, and I don't know why I can read in the characters only but not space.
2. after this I convert my data into double type, then convert into binary, and store them into an array with type double/char, and get something like below (2 characters in this case)
a = [01101101 10110111]
a can be either in type char or double, and has 2 cells.
and I want to convert it into
b= [0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1]
so now b is an array with 16 cells, and type is double
so what i am really doing is to break my message into binary stream
how should I perform it please?
Many thanks in advance
1. Are you using operator >> to read in the data? It skips whitespace by default. If you're reading one character at a time, use cin.get(). If you're reading in doubles, you can also use >> to read directly into a double instead of converting it yourself.
but if I store the ACSII in array like in a, how can I break them into b please?