473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Plss advise on writing VC++ code for interactive execution of an executable (Plink)

Hi,

I'm trying to write VC++ code for using Plink (command-line tool of PuTTY) interactively from within my program which is a console type windows application.

The basic purpose is to run commands on a Linux server remotely from my windows application through encrypted ssh provided by the Plink tool. And the result returned from the server needs to be captured in a log file for further processing. I plan to segregate this code into a separate DLL so that it can be called from the primary windows console app, and will run as a backend to it.

My main concerns are:
* Which function call should I be using to run the command-line Plink tool, is it System() or ShellExecute() or do you suggest a diff. alternative?
* After I send a command, how do I capture the STDOUT and STDERROR (without terminating this instance, i.e. keeping it interactive) so that I can check if the server is waiting for additional input or if the command has been executed?

As I'm previously from a linux background, I would really be thankful if you can point me on how to go about implementing this in VC++ (2003.net).

Thanking you in advance!

\Rennie
Mar 12 '07 #1
2 2200
Banfa
9,065 Expert Mod 8TB
Use CreateProcess

In the STARTUPINFO structure you can supply handles to OS objects to use for stdin, stdout and stderr. By creating and using pipes you can then direct the output back to your own process.

You will need to set the InheritHandles parameter to TRUE.
Mar 12 '07 #2
Thanks Banfa, I'm going ahead with your idea.

Hope you will help me out if I run into some trouble!

BR,
Rennie
Mar 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Allan Adler | last post by:
In C, I can execute system("gs gleep.ps"); and have C run a ghostscript program gleep.ps, which might ask for user input and, when it gets it, take some actions and report back to the C...
4
by: RajW | last post by:
Is it possible to make VC.NET 2003 produce an MS DOS (no Windows) executable? If so how? I was able to get it to produce an MS DOS executable, but when I copied the file to a plain DOS (legacy)...
4
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an...
5
by: Felix I. Wyss | last post by:
Good Afternoon, I recently noticed that some very simple methods of a template declared and used in a DLL library get inlined when used by the DLL itself, but not by other DLLs and EXEs. After...
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
1
by: Eric | last post by:
I have 2 projects in a VC 6.0 workspace. One is a C++ static library. The other is an executable that is dependent on the static lib. In the Linker options for the executable, I have included the...
10
by: Justin | last post by:
We have a simple shell script called testsp.sh (located at /home/ userid) Within the shell script, the following command is called: db2 -tvf callsp.sql When the shell script is run in command...
2
by: sowm18 | last post by:
Hi, Here iam developing the .exe file for the Distribution and Deployment in other windows machines where TCL and SSH client is not installed. I had written a script in TCL to automate SSH Login...
10
by: Allonii | last post by:
Hello! I’m new to this forum and in need of some advice. I have learned the basics of java in the school as I’m studying computer science. I would rather learn C++ though. You can create...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.