That is, quite frankly, terrible!
Why have you got two length parameters? What happens if "length" is greater than "imgsize1"?
Why are you commenting exactly what the code says, instead of what the code is trying to achieve? Anyone who reads this can tell that:
if(ascii % 2 == 0)
means
Why are you outputting backwards and then reversing it? why not do it all in one step?
Why isn't the code for converting a byte in a separate routine?
Why are you doing it this way?
if(ascii % 2 == 0)
{
binary_reverse[y] = 0;
}
else if(ascii % 2 == 1)
{
binary_reverse[y] = 1;
}
Why not
binary_reverse[y] = ascii % 2;
Why not just have one loop?
for(int i = 7; i >= 0; i--)
{
binary[i] = (ascii & 0x80) ? 1 : 0);
ascii <<= 1;
}
And on top of that, which FEC do you want to use?
wiki - Forward_error_correction[
^]
[edit]Oops - should have been "--" in the loop, not "++". Forgot to move the ascii bit, as well. I dunno, Sunday mornings...[/edit]