I am getting abpve error at line str.append(ch); in below code.
I basically want to append str with each char ‘ch’.
If someone know the issue please correct my error.
int extract(unsigned char data, char i); // Signature of extract function
void decoded(istream& input,ostream& output)
{
int cnt;
int x;
input.read((char*)&x,sizeof(x));
cout<<x;
cnt=x;
string str;
char ch;
for ( ; ; )
{
char c;
input.read((char*)&c,sizeof(char));
if ( input )
{
//read_bit(c,output);
for (int i=7; i>=0; i--)
{
if(cnt)
{
cnt--;
ch=(char)(((int)'0')+extract(c, i));
str.append(ch);// I am getting error at this line.
if(huffmanFindTable[str])
{
output.write((char*)&(huffmanFindTable[str]),sizeof(char));
str.clear();
}
else
{
}
}
}
}
else
break;
}
}
Like the compiler says, there is no member function with the signature
You can use either
or the simpler