473,379 Members | 1,245 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,379 software developers and data experts.

cannot start a Process and access standardInput

I looked at
http://www.codeproject.com/csharp/La...target=process and
tried to follow the code there. My code is:

public class Test
{
public ProcessStartInfo StartInfo;
public StreamWriter R_Input;
public StreamReader R_Output;
public Process Rprocess = new Process();

public Test()
{
}

public void StartR()
{
StartInfo = new ProcessStartInfo(
@"C:/Program Files/R/rw1062/bin/Rterm.exe",
@"--no-restore --no-save");

StartInfo.RedirectStandardInput = true;
StartInfo.RedirectStandardOutput = true;
StartInfo.UseShellExecute = false;
StartInfo.CreateNoWindow = false;
Process.Start(StartInfo); //line 12

R_Input = Rprocess.StandardInput; //ine 13
}
}

I can see the process start correctly after line 12 (it appears in the
Windows Task Manager, and a console starts up). But line 13 always raises
the exception:
"StandardIn has not been redirected."

I don't know much about the program Rterm.exe itself
(http://www.r-project.org/), but the documentation would imply no problem in
redirecting stdIn and stdOut in a .bat file:

"Otherwise you can set up a batch file using Rterm.exe. A sample batch file
might contain (as one line)

path_to_R\bin\Rterm.exe --no-restore --no-save < %1 > %1.out 2>&1"
Can someone suggest a cause and a fix for this problem?
Nov 15 '05 #1
1 15296
> Process.Start(StartInfo); //line 12
R_Input = Rprocess.StandardInput; //ine 13

I can see the process start correctly after line 12 (it appears
in the Windows Task Manager, and a console starts up).
But line 13 always raises the exception:
"StandardIn has not been redirected."


Um... in line 12 you get the actual process that was created. Store that
reference in Rprocess. In other words, change line 12 to:

Rprocess = Process.Start(StartInfo);

That should work,
-JG
Nov 15 '05 #2

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

Similar topics

2
by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they...
9
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
4
by: Yiu | last post by:
upgent help i want to start IE explorer using C# i try many code such as below: ProcessStartInfo startInfo = new ProcessStartInfo("IEXPLORE.EXE"); Process.Start(startInfo); or Process...
2
by: O_Spring | last post by:
I am writing a program in c#. I would like to read a binary file to the standard input of a process (it is flac.exe to encode/decode some files). I have tried to use the following code : ...
4
by: Marc Jennings | last post by:
Hi all, I want to run an external app from an assembly. Simple enough... > Process ExtProcess = new Process(); > ExtProcess.StartInfo.FileName = myAppName; > ExtProcess.StartInfo.Arguments =...
12
by: John F. | last post by:
Here is my code; Dim psi As New System.Diagnostics.ProcessStartInfo psi.UseShellExecute = True psi.FileName = "C:\WinProg.exe" System.Diagnostics.Process.Start(psi) Have tested WinProg.exe...
0
by: B Loggins | last post by:
Hi everyone, thanks in advance fo any help on this issue. I'm trying to "wrap" cmd.exe. That is, I'm redirecting StandardInput and StandardOutput for a cmd.exe process and I'm sending StdOut to...
7
by: TheRain | last post by:
Hey there, I am writing some test code, trying to hook standard IO from cmd.exe. What I really want to do is to open cmd.exe, keep it open, and have it process the DOS commands as I sent them...
6
by: somequestion | last post by:
there are some dos command < or > it can use like this if there is a batch file as sample.bat sample.bat < parameter sample.bat parameter result . i just wanna use this when i use...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.