Hi!
I'm writing a simple executable in C that needs to open a putty session and send commands to it, then close putty. I can open/close the putty session (i'm not that bad) but i'm not too sure on how to send putty the commands.
Any ideas??
Hi!
I'm writing a simple executable in C that needs to open a putty session and send commands to it, then close putty. I can open/close the putty session (i'm not that bad) but i'm not too sure on how to send putty the commands.
Any ideas??
So if you are opening it with a pipe (e.g. with popen), can't you just write the commands to the write-end of the pipe?
-- MarkusQ
From the PuTTY FAQ:
How can I use PuTTY to make an SSH connection from within another program?
Probably your best bet is to use Plink, the command-line connection tool. If you can start Plink as a second Windows process, and arrange for your primary process to be able to send data to the Plink process, and receive data from it, through pipes, then you should be able to make SSH connections from your program.
This is what CVS for Windows does, for example.
Plink can use PuTTY's saved sessions in addition to opening sites directly.
PLink's options are documented in Chapter 7 of the PuTTY manual.