bash - Passing Arguments Through system() in C++ -


how pass command line variable though system() command in c++. have tried using:

string i; = system("./findname.sh"); += argv[1]; cout << i; 

but when run gives me condition wrong number of arguments have written in shell script.

this output received when running program "./findname brandonw". executable file ran argument want shell script run with.

the arguments put are: brandonw usage: findname.sh [only_one_argument] 

just concatenate command string.

string command = "./findname.sh"; command = command + " "  + argv[1]; system(command.c_str()); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -