Frage

I nead to load a file ficture.txt,... run huffman and save it to a file so far I only have it working for textfiles. Can any one please tell me what function to use to load/save any data and convert it to bits/ from bits

War es hilfreich?

Lösung

One byte at a time is the smallest amount one can read from a file.

So, you can read a byte at the time and store it an a char variable.

Then, you can extract the bits of the byte, by using bitwise operators << and >>.

Source

[EDIT]

Answering to the comment:

Read byte by byte from file in C++.

Also, you might want to take a look at the ifstream reference.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top