Need help with System.Diagnostics.Process.StandardOutput buffer si

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UHVjY2E=?=

    Need help with System.Diagnostics.Process.StandardOutput buffer si


    -- Hi I'm using vs2005, .net 2 for windows application. The application I
    started using System.Diagnost ics.Process is having a
    "listFiles.Stan dardOutput" buffer size problem. I was wondering where and
    how can I adjust the buffer size problem. I don't want to be limited to a
    set buffer size, is that possible? thank you.


    public static int GetNisFile(Syst em.Diagnostics. ProcessStartInf o psi,
    ref DataTable dtAccounts,
    ref ToolStripStatus Label slMain, ref StatusStrip ssMain, string
    userOrGroup)
    {

    string accountFile="", output="";
    int numOfAccounts = 0;
    System.IO.Strea mReader fileOutput = null, myOutput = null;
    System.Diagnost ics.Process listFiles;
    try
    {
    listFiles = System.Diagnost ics.Process.Sta rt(psi);
    if (listFiles != null)
    {
    myOutput = listFiles.Stand ardError;
    fileOutput = listFiles.Stand ardOutput;
    listFiles.WaitF orExit(30000);
    if (listFiles.HasE xited)
    {
    // Read and display lines from the file until the end of
    // the file is reached.
    accountFile = fileOutput.Read ToEnd();
    output = myOutput.ReadTo End();
    if (accountFile != null && accountFile != "")
    numOfAccounts =
    CPAUnix.ParseAn dInsertAccounts (accountFile,
    ref dtAccounts, ref slMain, ref ssMain, userOrGroup);
    }
    else
    MessageBox.Show ("Time out retrieving NIS" + userOrGroup +
    "accounts." ,
    "PowerADvantage ");
    }
    else
    MessageBox.Show ("Error starting process to read file.",
    "PowerADvantage ");

    return numOfAccounts;

    }
    catch (Win32Exception wex)
    {
    MessageBox.Show (wex.Message, "PowerADvantage ");
    return numOfAccounts;
    }
    }
    Thanks.
Working...