Hi All,

I am working on a situation suppose i am calling one exe(C++ code) from unix shell script now i want that 2 values in that unix script which this c++ code will get from some URL.
Any Idea how can i get those 2 values from C++ code exe to unix shell script.

Thnks
Rohit

Write the values to a file from your program.

ofstream outs( "data.txt" );
outs << value1 << "\n" << value2 << std::endl;

Choice of shell matters. Here I use bash and awk.

value1=`awk 'NR==1' data.txt`
value2=`awk 'NR==2' data.txt`

If you want to avoid the file on disk, you can always write to std::cout and pipe the result into awk. Etc.

Hope this helps.