We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In main.cs these lines show how to convert huffman code (vector of bools) to the stream. But how to convert the stream back to vector of bools?
short r = code.size()%8; long bsize = ((code.size()-r)/8); //I am keeping the stream in memory. //std::ofstream outfile ("out.huf",std::ofstream::binary); std::stringstream outbuff; unsigned char byte[1]; unsigned char firstByte[1]; firstByte[0] = 0; if((r-(r%4))/4) firstByte[0] |= 1 << 2; if(((r%4)-(r%2))/2) firstByte[0] |= 1 << 1; if(r%2) firstByte[0] |= 1; outfile.write (reinterpret_cast<char *>(firstByte),1); for(int y=0;y<(bsize+1);y++) { //byte byte[0] = 0; for (int i=0; i < 8; ++i) { //bit if ((8*y+i) <= code.size() && code[8*y+i]) { byte[0] |= 1 << i; } } outfile.write (reinterpret_cast<char *>(byte),1); }
How to decode outfile stream back to vector ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In main.cs these lines show how to convert huffman code (vector of bools) to the stream.
But how to convert the stream back to vector of bools?
How to decode outfile stream back to vector ?
The text was updated successfully, but these errors were encountered: