473,651 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with controlling stdin/stdout for a child process

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
Jul 22 '05 #1
1 3906
"Mike Finister" <RE************ ***@finisterTO. netUSE> wrote in message news:<cd******* ***@hercules.bt internet.com>.. .
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(),spawnl e(),spawnlp(),s pawnlpe();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).

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8991
by: | last post by:
Maybe I ask something OS depended but maybe not. So I ask: I want to run an external program from my C++ program. I want stdin of external program constructed from a C++ string in my program. I want stdout of external program constructs a C++ string in my program. Is this possible without intermediate temporary files?
3
18368
by: Harayasu | last post by:
Hi, Using fgets() I can read from stdin and with fputs() I can write to stdout. Now I have two programs, one writing to stdin and the other one reading from stdin. And I would like the second program to read the characters the first program has written to stdin, but I don't get it how to do this. The program which writes to stdin:
3
893
by: Mike Finister | last post by:
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...
2
4572
by: Jacek | last post by:
Hello! My application has to use external native library writing to stdout and stdin. My goal is to redirect output within running process (no chance to do that in child process - Process class redirection is useless in that case) and I would like to do it without reverting to C-run time library P/Invoke calls. Any ideas how to do that?
3
1962
by: Piripiccio | last post by:
Hello , please give me a little minute for this problem the first thing ..... my english is very bad I wrote a little program that using a socket pair with 2 process Padre (Father) and Figlio (Son) but the select see the future . This is the code ... please help me before i become crazy .....
2
1651
by: Toby | last post by:
I'm trying to write a simple commandline wrapper: a script that runs another program as a child and relays unbuffered stdin and stdout to/from the child process, possibly filtering it. The usefulness of such a program lies in the filtering stage, in a possible integration with readline, or in other interface enhancements. Still, I'd like to discuss with you the unfiltered, unembellished version, because I'm not satisfied with it and...
4
11276
by: xman | last post by:
I'm looking for a C/C++ library that can get access to the stdin and stdout of a process. I may invoke a external program in a C/C++ program, but how do write data into the stdin of the external program, and read data out from the stdout of the external program? Suggestions are much appreciated.
6
5470
by: xhe | last post by:
I am using ffmpeg to convert video, this is a sample script: $str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/ cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar 22050 -y /home/transla1/public_html/cybertube/web/uploads/video/ generated/31_70_AK000005.AVI.flv '; //exec($str); runExternal($str,$code); echo $code ;
8
9156
by: rdabane | last post by:
I'm trying to perform following type of operation from inside a python script. 1. Open an application shell (basically a tcl ) 2. Run some commands on that shell and get outputs from each command 3. Close the shell I could do it using communicate if I concatenate all my commands ( separated by newline ) and read all the output in the end. So basically I could do following sequence: 1. command1 \n command2 \n command 3 \n
0
8347
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.