I tried to find possible solution on Google, but all I found is explanation on how to return value, but not how to accept it in some programming language, in my case C/C++? Does anybody have idea on how to do this? Some tips? 
Forwarding return value of shell script to C/C++
shell script;c;c++;return status
I'm focussing on Linux, but my answer probably fits for other POSIX systems.You'll execute your shell script from a C or C++ program with some of:the usual mixture of fork(2), execve(2), waitpid(2), and then waitpid gives you the exit code using WEXITSTATUS when WIFEXITEDthe system(3) C standard library function. It returns what the internal waipid implementing it is returningthe popen(3) POSIX standard library function. Use WEXITSTATUS on the result of pcloseBoth system & popen are using the fork, execve, waitpid system calls (and some others, see syscalls(2) for a list).Read any good book on Linux system programming for details (e.g. Advanced Linux Programming by M.Mitchell et al; you'll find copies on the Web, or APUE etc...)