Help with controlling stdin/stdout for a child process

M

Mike Finister

Hi there

At the moment I am writing a GUI front-end that in the background is to call
some scripts on a Unix box. The GUI has to be written in Visual Basic (yes I
said the VB word...sorry! :) )

The big issue is that the command line utility that has to be used in order
to access the Unix box asks for a password (you can send the user ID as a
parameter). I can get the password securely from the user in the GUI...but
I have to somehow send this to the command line.

I have been looking for VB hosted ways of doing this...and there doesn't
seem to be an easy way of doing it...plenty of possibles...but all have
their drawbacks.

So...I'm dusting off my C/C++ skills to see if I can write a utility that
will have this Unix link as a child and somehow control the input/output.
As a quick/dirty solution I was going to write out any collected output from
the Unix link (I will be doing directory listings/file contents etc.) into a
text file that the VB program can then read in (yup...the whole thing is
pretty quick and dirty...that's OK...it just needs to be functional).

Now I last used C/C++ in the early 90's and have forgotten all the DOS
secrets I once knew...so a plea for help.

Does anyone have any example code (or knows where some exists) that shows
how to fire up a child process and collect its output (from stdout) and be
able to send in keystrokes (for firing in the password).

All help much appreciated...

Thanks

Mike
 
A

aman

Mike Finister said:
Hi there
hello

Now I last used C/C++ in the early 90's and have forgotten all the DOS
secrets I once knew...so a plea for help.

Does anyone have any example code (or knows where some exists) that shows
how to fire up a child process

the new child process can be fired up using the functions
spawnl(),spawnle(),spawnlp(),spawnlpe();all these are available with
borland's turbo c++, the header file to be included is process.h ,info
about arguments etc can be obtained from turbo's help
and collect its output (from stdout)
i do not know about that
though i have a suggestion you can spawn the child process with the
parent process waiting(by using proper arguments ),store the output of
child process
in a temp file and then open that file from the parent process
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top