coded so far
int pushintomemory(unsigned char *buffer,int offset) { int i = 0; for(;;) { if(buffer[offset + i] == 0x90) { i++; } else { break; } else { j = i+2; } if(i == 5) { i = rand()%3 + 3; break; } } return i; }
Look at this picture: www.danlhenry.com/.../keil_code.png it shows you that the instructions for posting source code are simple and clearly-stated.
I don't feel like delving into this (still) not formatted code, bu tit looks like your first "break" should be replaced by a "continue". Anything that follows it is dead code!
Do you really consider that to be legible??!
What is the code supposed to do?
What actually happens when you run it?
What debugging have you done in an attempt to account for the difference?
again
int pushintomemory(unsigned char *buffer,int offset)
{
int i = 0;
for(;;)
if(buffer[offset + i] == 0x90)
{i++;}
else
{break;}
else {j = i+2;}
if(i == 5)
{ i = rand()%3 + 3; break; }
}
return i;
"You can lead a horse to to the river but you cannot force it to drink".
True - But while you're at the water you could at least put the poor beast out of it's misery.
What was wrong with:
int pushintomemory(unsigned char *buffer,int offset) { int i = 0; for (;;) { if (buffer[offset + i] == 0x90) { i++; } else { break; } else {<===== two else for one if??? How do you get this through the compiler??? j = i+2; } if (i == 5) { i = rand()%3 + 3; break; } } return i; }
Besides trying to have two "else" with one "if", your code doesn't look like it would make sense.
Why have an infinite loop that either contain break or do not update variable i? Is it expected to skip an unknown number of buffer values 0x90? Why even have a rand() in your code, without any source code comments very clearly explaining what you think the code is expected to solve?
"True - But while you're at the water you could at least put the poor beast out of it's misery." Lots of misery here.