I use Eclipse and I try to execute shell commands
written in a cpp-file.
As far as I know, I can use the system()
function to execute a shell command
in cpp, but how can I respond to a prompt in the terminal?
I know that after a certain command the shell will ask for a password and I have to put it in there. At first I tried to put my password into a second system()
function but it didn't work. Although I put a sleep
call between both system()
function calls, it doesn't work:
system(DO)// after this command the shell asks for a password
sleep(10)
system(Password)`
How can I enter the password?