0

Inverse/ reverse bits in file, c++

I need a help, with a program, which reverses and inverses bits in files. I have a function, which reverses bits, but it only reverses that number, which i input in a code. I need a function, which reads the bit array (correct me, if i wrong) in file, for example "number.txt", reverses it by that function which i will post below, and saves it in a new file. And also inverse the bits in file, by analogy of reversing it. P.S. sorry for my english https://code.sololearn.com/cHKxANlwwPZJ/?ref=app

2nd Apr 2020, 4:06 PM
AndrreyD
AndrreyD - avatar
4 ответов
+ 2
What does your bit array in the file look like? Characters like "00100010"?
4th Apr 2020, 1:28 AM
John Wells
John Wells - avatar
+ 2
I added reading console string, converting to integer, and displaying both original & reversed in decimal & hexadecimal. Since you used std::, I removed the using as it defeats the purpose. We must write the file in order to read it in playground so left that for you. Enter 1100 to prompt or any other eight bit binary value. https://code.sololearn.com/cWNsYh2bKLvq
6th Apr 2020, 3:02 PM
John Wells
John Wells - avatar
+ 1
Thanks a lot!
6th Apr 2020, 3:04 PM
AndrreyD
AndrreyD - avatar
0
I have a task - to get the bits from bytes in the file. It can be the simple text, and i have to "pull out" bits from it, reverse it, and save. Yes, i tried to just reverse the array, but its wrong
6th Apr 2020, 9:09 AM
AndrreyD
AndrreyD - avatar