I am looking for a way in C++ to open a telnet or ssh connection from a windows machine. I currently am using a very old and deprecated system for this inventory system at work. Unfortunatly I am stuck with the system, but would like to create a nice front end with c++ to make some things easier to do and add extra functionality.

From a linux box I think I got the session open just using the system command but that of course doesnt work on windows. I can use telnet so I suppose system(telnet xxx.xxx.xxx.xxx) should work however I am also considering piping from my program into a Putty ssh client.

Using the system() command to open a telnet, how would I actually send the commands? And if I use piping to work with the Putty client can I pipe commands to the client? Example: It is a text menu driven system and the first menu has 2 entries, 1) products 2) reports. So normally I would just hit "2 enter" to get to the next menu. Is it possible to pipe something like that? i.e. pipe << "2\n"; ?