we have been given the assignment to implement a Shannon Fano compression algorithm in C++. While the algorithm wasn't much of a problem, I have some trouble with reading the given files (txt, excel, BMP) as binary for compression purposes.
The prof. gave us a few tips on it, but I don't get how they are supposed to be used. He said we should make an object that takes in the path to the file. It then has methods to read a bit, read a byte, read an integer and read a float from the binary file. While I get what readBin and readByte do, I don't understand how one would use the readInt or readFloat method (how the fstream would know that the next char is an int or a float).
Does anyone have any idea on how to implement the binary reading with the methods I have listed above? Thanks!
intorfloat? However, interpreting your task is offtopic for SO, please ask your professor for clarification. And please show us your efforts and where you got stuck. - churill