Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Help with controlling stdin/stdout for a child process

Reply
Thread Tools

Help with controlling stdin/stdout for a child process

 
 
Mike Finister
Guest
Posts: n/a
 
      07-24-2004
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


 
Reply With Quote
 
 
 
 
aman
Guest
Posts: n/a
 
      07-24-2004
"Mike Finister" <(E-Mail Removed)> wrote in message news:<cdt5dq$gp4$(E-Mail Removed)>...
> 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

> able to send in keystrokes (for firing in the password).

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pexpect on windows - child process of another child process - quickquestion Z W Python 0 03-09-2013 10:00 PM
Child process wait father process excute some code then begin execute empriser C Programming 1 03-06-2007 02:24 AM
Help with controlling stdin/stdout for a child process Mike Finister C Programming 3 07-24-2004 04:11 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM
parenp process controlling child Monika Talwar Perl Misc 1 09-12-2003 09:04 AM



Advertisments