I have one shell script which is calling a C executable. That C executable returns a value depending upon operations inside the C code. But how to get that value in the calling shell script?
The syntax of calling the C executable is like --
C_exec <argc no> <argument1> <argument2> etc ...
When I am doing
return_value=C_exec <argc no> <argument1> <argument2> etc ...
The runtime error is shown as --
<argc no>: not found
Thanks vino for ur reply. But that syntax is not working.
Instead grumpf's suggestion is working. Thanks grumpf and jim mcnamara.
My problem is solved. But, just out of curiosity, I want to know the way of returning a character string or simply a character from C executable to calling shell script.
The exit code mechanism is working basicly since main() is int. What you see on shell is the return
code of main() (using void main() is therefore a BAD idea).
A string is something different. The easy way retvar=$( myprg ) works only IFF there is no
other output.