0

Any forward error correction (FEC) implementation in C++? i need it for my project. i converted character into ascii value then converting them into binary values.now i need to append error correcting bits.

i m doing my project in vc++. following is part of my code:

```
array< array< int >^ >^ chartobin(array<Char>^arr,int length,int imgsize1)
{
//converts entered characters into binary n stores in message array
int ascii;
array< array< int >^ >^ messag= gcnew array< array< int >^ >(imgsize1);
for(int i=0;i<imgsize1;i++)
{
messag[i] = gcnew array<int>(8);
}
for(int x= 0;x<length;x++)
{
ascii =(int) arr[x];
int* binary_reverse = new int [9];
int* binary = new int [9];
int y = 0;
while(ascii != 1)
{
if(ascii % 2 == 0) //if ascii is divisible by 2
{
binary_reverse[y] = 0; //then put a zero
}
else if(ascii % 2 == 1) //if it isnt divisible by 2
{
binary_reverse[y] = 1; //then put a 1
}
ascii /= 2;
y++;
}
if(ascii == 1) //when ascii is 1, we have to add 1 to the beginning
{
binary_reverse[y] = 1;
y++;
}
if(y < 8) //add zeros to the end of string if not 8 characters (1 byte)
{
for(; y < 8; y++) //add until binary_reverse[7] (8th element)
{
binary_reverse[y] = 0;
}
}
for(int z = 0; z < 8; z++) //our array is reversed. put the numbers in the rigth order (last comes first)
{
binary[z] = binary_reverse[7 - z];
if(binary[z]==0)
{
binary[z]=-1;
}
}
for(int z = 0; z < 8; z++)
{
messag[x][z]=binary[z];
}
delete [] binary_reverse; //free the memory created by dynamic mem. allocation
delete [] binary;
}
return messag;
}
```

now by taking messag[x][z]=binary[z] i need to append error correcting bits. i need it urgently.pls help..