473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 4148
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**********@planet.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**********@planet.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/
frlrfsystemdiagnosticsprocessstartinfoclassredirec tstandardinputtopic.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.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.Arguments = "C:\Test1 C:\TestA\"
p.StartInfo.WorkingDirectory = "C:\windows\system32"
p.StartInfo.FileName = "xcopy"
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
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\mytest.txt")
sw.Write(sb.ToString)
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
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
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
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...
2
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...
3
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,...
8
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...
1
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...
0
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...
0
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.