Thanks for your reply.

If I replace the inkey function with a dummy that just passes an ever increasing int every time it i called, I get no error.
Quote:

int number_input() //dummy
{
global_counter++;
return(global_counter-1);
}

//The way I call the function
int loc_i2 = number_input();


I see, so the problem lies in timing. Program skips ahead to what follows the function call with a value of 0, then after inkey is terminated the rest of the commands in the function are executed but its now too late to pass the int to the function which has already finished executing, wreaking havoc with the code.

At this point I am feeling like a total noob...So how can I make the function wait for the input? "while(number_input() == 0){wait(1);} doesn't seem to do the trick. Alternatively, just having

Quote:

int number_input(){
inkey((t_input.pstring)[0]);
result= str_to_int((t_input.pstring)[0]);
}

//and calling
number_input();
while(inkey_active != 0){ wait(1); }
wait(-1);
loc_i2 = result;

results in a similar overrun, because the function call is in a loop thats executed 3 times, I only get to enter the number once, after which the same number is feed back another 2 times.

I'm going bonkers over this...


- Mr Wurm