AT_CMD_LOCAL - Will not return AT command result to main

I am playing with the sample program at_cmd_local and cannot figure out how to capture an AT command result. I call the AT command but no matter what I try I cannot capture the result, its stored in the response->value_bytes array in the function called command_dump. Could someone explain how I could do something equivalent to:

get_atcmd_value(“TP”);
Temperature = response->value_bytes;
or
Temperature = get_atcmd_value(“TP”);

The problem isn’t setting up pointers or a global variable to capture the result, the issue is that main does not wait for get_atcmd_value(“TP”); to finish, it continues on meaning I don’t have a temperature value to use in the rest of Main.

Thank you for any help,
Jason

I could not figure out how to capture the AT result in MAIN so I had to place code within the command_dump function. I am no C coder so pardon the possibly poor code, but it works.

//Sends Temperature info
if ( strncmp(response->command.str, “TP”, 2) == 0 )
{
//WORKS
memset(SendBuffer, 0, 100 * sizeof(SendBuffer[0]));
printf("
AT Read: %s = %d
", response->command.str, response->value_bytes[1] );
strcat(SendBuffer, “Temperature:”);
sprintf(IntegerString, “%d”, response->value_bytes[1]);
//sprintf(IntegerString, “%02x”, response->value_bytes[1]);
strcat(SendBuffer, IntegerString);
env.payload = SendBuffer;
//printf("AT env.payload: %02x
", env.payload );
env.length = strlen(SendBuffer);
//printf("AT env.length: %i

", env.length );

  //Sends data
    xbee_transparent_serial(&env);
}