Click here to Skip to main content
15,888,527 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I check whether a user is in an Active Directory group when given its username and password Pin
Andrew_1-Aug-09 22:13
Andrew_1-Aug-09 22:13 
GeneraliGrid Pin
CoderForEver1-Aug-09 20:35
CoderForEver1-Aug-09 20:35 
Questionhow to pass Date format "mm/dd/yyyy " to Sql Stored procedure Pin
Zapss1-Aug-09 19:37
Zapss1-Aug-09 19:37 
AnswerRe: how to pass Date format "mm/dd/yyyy " to Sql Stored procedure Pin
Abhishek Sur1-Aug-09 21:18
professionalAbhishek Sur1-Aug-09 21:18 
AnswerRe: how to pass Date format "mm/dd/yyyy " to Sql Stored procedure Pin
Mycroft Holmes2-Aug-09 12:26
professionalMycroft Holmes2-Aug-09 12:26 
Question.NET Licenser? Pin
devvvy1-Aug-09 14:10
devvvy1-Aug-09 14:10 
AnswerRe: .NET Licenser? Pin
Moreno Airoldi2-Aug-09 1:02
Moreno Airoldi2-Aug-09 1:02 
QuestionPipping data to and from process Pin
BigBenDk1-Aug-09 12:44
BigBenDk1-Aug-09 12:44 
What I need to do is something like this.

DataCruncher.exe < input.bin > output.bin
It is an application that is called in the command prompt.
The input.bin file is piped in, and the result is outputed to output.bin. Works great.

Now instead of starting the app from a command prompt, I need to call it from a C# app.

ProcessStartInfo info = new ProcessStartInfo(location);
info.Arguments = BuildArgs();
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.UseShellExecute = false;
            
_process = Process.Start(info);
_toApp = _process.StandardInput.BaseStream;
_fromApp = _process.StandardOutput.BaseStream;


The input is in binary format, and so is the output, so I used the basestream instead of the StreamReader.

My problem is that it is blocking when im reading from the standard output.

while (true)
{
  int read = _fromApp.Read(readbuffer, 0, readbuffer.Length); // <-- blocks

  if (read == 0)
    break;

  //Do something with the data.
}


It looks like it is blocking the stream until it has all the bytes to fill the readbuffer array.

Is there something I should be aware of when read/writting to a process?
AnswerRe: Pipping data to and from process Pin
Luc Pattyn1-Aug-09 13:18
sitebuilderLuc Pattyn1-Aug-09 13:18 
GeneralRe: Pipping data to and from process Pin
BigBenDk1-Aug-09 15:13
BigBenDk1-Aug-09 15:13 
GeneralRe: Pipping data to and from process Pin
Luc Pattyn1-Aug-09 15:25
sitebuilderLuc Pattyn1-Aug-09 15:25 
GeneralRe: Pipping data to and from process Pin
BigBenDk1-Aug-09 16:35
BigBenDk1-Aug-09 16:35 
Questionrun cmd.exe Pin
rick05561-Aug-09 12:15
rick05561-Aug-09 12:15 
AnswerRe: run cmd.exe Pin
Abhijit Jana1-Aug-09 13:06
professionalAbhijit Jana1-Aug-09 13:06 
AnswerRe: run cmd.exe Pin
PIEBALDconsult1-Aug-09 13:26
mvePIEBALDconsult1-Aug-09 13:26 
GeneralRe: run cmd.exe Pin
Xmen Real 1-Aug-09 18:02
professional Xmen Real 1-Aug-09 18:02 
QuestionRe: File Properties Pin
rick05562-Aug-09 19:47
rick05562-Aug-09 19:47 
QuestionURL's Pin
Gregory Bryant1-Aug-09 11:34
Gregory Bryant1-Aug-09 11:34 
AnswerRe: URL's Pin
Henry Minute1-Aug-09 11:59
Henry Minute1-Aug-09 11:59 
GeneralRe: URL's Pin
Gregory Bryant1-Aug-09 13:04
Gregory Bryant1-Aug-09 13:04 
GeneralRe: URL's Pin
Richard Andrew x641-Aug-09 14:14
professionalRichard Andrew x641-Aug-09 14:14 
GeneralRe: URL's Pin
Gregory Bryant1-Aug-09 15:56
Gregory Bryant1-Aug-09 15:56 
GeneralRe: URL's Pin
Richard Andrew x641-Aug-09 16:05
professionalRichard Andrew x641-Aug-09 16:05 
GeneralRe: URL's Pin
Gregory Bryant1-Aug-09 16:10
Gregory Bryant1-Aug-09 16:10 
GeneralRe: URL's Pin
Gregory Bryant1-Aug-09 16:28
Gregory Bryant1-Aug-09 16:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.