473,545 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

redirecting STDIN/STDOUT

hi,

I have some problem with redirecting input and output from a process.
Situation:
I have to use the Cisco Network Registrar (DNS And DHCP server) command
line utility as redirecting its input and output so I can interact with this
one. This utility is similar to ftp under a win32 console. It proposes its
own prompt after launching it.

What I want to do is:

- input some command (normally I have to write into the input stream)
- then get the response from the output stream.

This operations sequence must be repeated more than one time

I create a process with the right parameter such as useshell=false and
redirect in,out,err =true and app name =cmd.exe
(when I use directly app=<utility> it does not work)

when I write the command into the InputStream, I go a correct response into
the response stream but incomplete. In fact, there is one or more streams
behind the first one. You can get these streams if you pass in addition to
the peek function.
Then, after gathering the last stream the application freeze !

I already seek for code to achieve my goal but all code I've found doesn't
work for my situation
Code tested : VB.Net, VB and API, C/C++
How can I solve my problem, can anyone help me!

After many and many hours searching, I despair
Thanks a lot!


Nov 20 '05 #1
6 4159
Hi Christophe

I absolut do not know how to solve your problem, however when you said the
same as ftp I had to think on this website, maybe it is there.

http://www.indyproject.org/indy.html

Cor
Nov 20 '05 #2
Thanks for answer but this cannot help me, it's completely different.

"Cor Ligthert" <no**********@p lanet.nl> a écrit dans le message de news:
e9************* *@TK2MSFTNGP12. phx.gbl...
Hi Christophe

I absolut do not know how to solve your problem, however when you said the
same as ftp I had to think on this website, maybe it is there.

http://www.indyproject.org/indy.html

Cor

Nov 20 '05 #3
Hi Christopher

Is this commandline standard in and output because than maybe this can help
you

http://msdn.microsoft.com/library/de...inputtopic.asp

Cor
Nov 20 '05 #4
I allready view the microsoft site and many other. Apparently I'm the only
one on earth who have this problem

"Cor Ligthert" <no**********@p lanet.nl> a écrit dans le message de news:
e6************* *@tk2msftngp13. phx.gbl...
Hi Christopher

Is this commandline standard in and output because than maybe this can help you

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdiag nosticsprocesss tartinfoclassre directstandardi nputtopic.asp
Cor

Nov 20 '05 #5
Hi Christopher,

I thought I had used this sample however it is not true, can you try this
one I made a short while ago (based on an MSDN sample), this is a sample for
the standardoutput I showed someone some days ago, so you have to make the
standardinput something the same.

Maybe this helps?

Cor

Dim p As New Process
p.StartInfo.Use ShellExecute = False
p.StartInfo.Red irectStandardOu tput = True
p.StartInfo.Arg uments = "C:\Test1 C:\TestA\"
p.StartInfo.Wor kingDirectory = "C:\windows\sys tem32"
p.StartInfo.Fil eName = "xcopy"
p.Start()
Dim sr As IO.StreamReader = p.StandardOutpu t
Dim sb As New System.Text.Str ingBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW( input))
input = sr.Read
Loop
Dim sw As New IO.StreamWriter ("C:\Test2\myte st.txt")
sw.Write(sb.ToS tring)
sw.Close()
Nov 20 '05 #6
* "Christophe Helfer" <ch************ ***@ires.in2p3. fr> scripsit:
I have some problem with redirecting input and output from a process.
Situation:
I have to use the Cisco Network Registrar (DNS And DHCP server) command
line utility as redirecting its input and output so I can interact with this
one. This utility is similar to ftp under a win32 console. It proposes its
own prompt after launching it.

What I want to do is:

- input some command (normally I have to write into the input stream)
- then get the response from the output stream.


<URL:http://dotnet.mvps.org/dotnet/samples/miscsamples/downloads/RedirectConsole .zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7

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

Similar topics

4
38711
by: Jan Knop | last post by:
Hello I am writing a Windows application where I need to redirect stdin, stdout and stderr from Python. to my application Is it a simple way of do it ? Has anyone done it using Winsock ?
1
2820
by: Michael McGarry | last post by:
Hi, How do I redirect stdin, stdout and stderr to a window? I am using Qt for GUI. Thanks, Michael
0
1809
by: lickspittle | last post by:
Hi, I have Python embedded with my other code, and when my other code opens a console and redirects stdout, stdin and stderr to it, then calls PyRun_InteractiveLoop, it immediately returns with an EOF. After some debugging the reason for this appears to be that the stdin and stdout that the ReadLine function in the tokeniser include are...
2
4564
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
2384
by: Jan Danielsson | last post by:
Hello, I thought I'd write a program to collect information from pf (packet filter) and insert it into a postgresql database for review on a web page. First I checked if this has been done already, and found that it has.. Using Perl and SQLite in a program called "hatchet". Well, I want to do it in Python, and I want to use postgresql. ...
8
5768
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can technically create an executable that calls the function and then using a command prompt call the exexutable using the > output.txt redirector but I...
1
2575
by: pp4175 | last post by:
Hello Everyone, I am currently working on writing a GUI wrapper for a Menu driven DOS Program. What I was looking on doing is redirecting stdout/stdin to a stream and read/write similar to a file. My issue is that I try to read from the stdout stream and never get anything only if the program has exited. Is there a way of reading the...
0
1326
by: carl.dhalluin | last post by:
Hi I want a simple way to interactively remote debug a running python script which has no tty terminal attached to it. The scripts are running standalone (i.e. they are automatically started and have no terminal) and very infrequently come into error conditions which i want to understand and debug. The idea is that I do the debugging as...
0
2561
by: kreismaler | last post by:
I have some problems to understand the difference of using the STDOUT and using "anonymous pipes" as shown below: using System; using System.Diagnostics; using System.IO; namespace ProcessTest { class Program
0
1977
by: Gabriel Genellina | last post by:
En Thu, 25 Sep 2008 09:49:31 -0300, Almar Klein <almar.klein@gmail.com> escribió: Use subprocess.PIPE Usually the tricky part is to figure out exactly whether there is more input or not. With Python it's easy, use the ps1 prompt. --- begin --- import sys
0
7393
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...
0
7653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7411
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...
0
5965
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...
1
5322
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...
0
3444
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...
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.