Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9178661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:36:19+00:00 2026-06-17T17:36:19+00:00

I am a newbie with Streams and I’m trying to write a function that

  • 0

I am a newbie with Streams and I’m trying to write a function that redirects a Process’s StandardOutput and returns the StandardOutput Stream so that it can be consumed elsewhere. When I return the Process.StandardOutput Stream in the method, how is that Stream stored? Does it just live in memory somewhere until it is consumed? Does it have a maximum size?

Here’s some example code that I have so far:

    public Stream GetStdOut(string file)
    {
        _process = new Process(file);
        _process.StartInfo.UseShellExecute = false;
        _process.StartInfo.RedirectStandardOutput = true;
        _process.Start();
        return _process.StandardOutput;
    }

    public bool CompareStreams()
    {
        Stream s1 = GetStdOut("somefile.exe");
        Stream s2 = GetStdOut("anotherfile.exe");

        using (StreamReader sr1 = new StreamReader(s1))
        using (StreamReader sr2 = new StreamReader(s2))
        {
            string line_a, line_b;
            while ((line_a = sr1.ReadLine()) != null &&
                   (line_b = sr2.ReadLine()) != null)
            {
                if (line_a != line_b)
                    return false;
            }
            return true;
        }
    }

So in CompareStreams(), do I need to be worried about how much data is associated with Stream s1 while I’m generating data for Stream s2? Or does this not really matter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:36:20+00:00Added an answer on June 17, 2026 at 5:36 pm

    The Stream object does not immediately get filled with all of the standard out data.

    As the processes run, they write to a buffer, and when the buffer is full, they will freeze until you read from the buffer.

    As you read from the buffer, that clears space for the process to write more data out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie C++ programmer here. I'm trying to write a command line application that takes
I'm a newbie to WCF, REST etc. I'm trying to write a service and
Python newbie here. I'm writing a script that can dump some output to either
Im a newbie to TCPClient, Im trying to make a webcam app that sends
Newbie jquery: does the .css() function alter css properties of an element if the
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie question since I'm not up to speed using maven at all. I'm trying
Newbie here. I am trying to store the result of my search onto a
Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.