Help with controlling stdin/stdout for a child process

Discussion in 'C++' started by Mike Finister, Jul 24, 2004.

  1. 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
    Mike Finister, Jul 24, 2004
    #1
    1. Advertising

  2. Mike Finister

    aman Guest

    "Mike Finister" <> wrote in message news:<cdt5dq$gp4$>...
    > 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).
    aman, Jul 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    858
    Raymond DeCampo
    Aug 30, 2005
  2. Mike Finister
    Replies:
    3
    Views:
    455
    Shug Boabie
    Jul 24, 2004
  3. Ferenc Engard
    Replies:
    2
    Views:
    147
  4. James Smith
    Replies:
    3
    Views:
    151
  5. Z W
    Replies:
    0
    Views:
    172
Loading...

Share This Page