I would simulate keyboard events in a c++ program.I would "trick" the computer, so it "think" a key has been pressed.I work in Fedora 14.Anyone know something about that?
I have to write a program whose purpose is to write the root user password on the terminal automatically.
I don't want make any illegal action, but only this program needs root privileges and I don't want all users to use root user.That's all.
I have tryed what you have just suggested but it doesen't work.After you write the command "su" on the terminal, then appear on the screen "Password:" and you have to write it manually.I want do that automatically with my c++ program.
Except theoretically you would probably ( http://linux.die.net/man/3/exec ) after forking. Or you could just pipe them from the command line like pipingProgam | su