Your function has no crash bug, so something else is crashing in your script, but probably your calling the function in a wrong way. The "return" makes no sense.

When you want to do something with the entered string, you must wait until the user has pressed the enter key. But your function returns immediately before the user has entered anything. So you cant do anything with the return value.

Code:
int number_input()
{
   inkey((t_input.pstring)[0]);
   printf("%d",str_to_int((t_input.pstring)[0]));
}


function main()
{
   number_input();
   printf("Immediate return!");

}


Hope this helps.