Posted By: NeoJT
Return Problem... - 04/24/13 15:06
Hi... (and sorry for my english)
I have created a function for checking a string with an array of strings
and i want to return the position of that string if exist ... otherwise return -1.
l_temp_1_array_str : contain the string.
g_commands_array : is a TEXT* that contain the strings that i want for check
g_commands_sum_int : is a variable that contain the sum of commands
l_temp_2_int : is the variable that i want to contain the position of string in array.
i have check inside that function and it works... and the l_i has the value that i want...
but the l_temp_2_int ( is the variable that call the int function ) takes a wrong number ... e.x.: (78775160)
(i have check this with the printf("%i", l_i); after the wait_for(f_check_str);
Please help...
thanks you all...
Best Regards.
Dimitris.
I have created a function for checking a string with an array of strings
and i want to return the position of that string if exist ... otherwise return -1.
l_temp_1_array_str : contain the string.
g_commands_array : is a TEXT* that contain the strings that i want for check
g_commands_sum_int : is a variable that contain the sum of commands
l_temp_2_int : is the variable that i want to contain the position of string in array.
Code:
. . int l_temp_2_int = 0; . . l_temp_2_int = f_check_str(l_temp_1_array_str); wait_for(f_check_str); . .
Code:
typedef var bool; //---------------------------------------- int f_check_str(STRING** l_temp_1_array_str) { int l_i; bool l_while_stop_bool; l_i = 0; l_while_stop_bool = false; while ( (l_i < g_commands_sum_int) && (l_while_stop_bool == false) ) { if ( str_cmp(l_temp_1_array_str[0], (g_commands_array.pstring)[l_i] ) ) { l_while_stop_bool = true; } else { l_i++; } wait(1); } if (l_while_stop_bool == true) { return l_i; } else { return -1; } }
i have check inside that function and it works... and the l_i has the value that i want...
but the l_temp_2_int ( is the variable that call the int function ) takes a wrong number ... e.x.: (78775160)
(i have check this with the printf("%i", l_i); after the wait_for(f_check_str);
Please help...
thanks you all...
Best Regards.
Dimitris.