Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralGames and depth of objects - help =) Pin
Anthony Mushrow3-May-05 7:44
professionalAnthony Mushrow3-May-05 7:44 
GeneralRe: Games and depth of objects - help =) Pin
Judah Gabriel Himango3-May-05 8:13
sponsorJudah Gabriel Himango3-May-05 8:13 
GeneralRe: Games and depth of objects - help =) Pin
Anthony Mushrow3-May-05 8:40
professionalAnthony Mushrow3-May-05 8:40 
GeneralRe: Games and depth of objects - help =) Pin
Judah Gabriel Himango3-May-05 10:35
sponsorJudah Gabriel Himango3-May-05 10:35 
GeneralRe: Games and depth of objects - help =) Pin
Anthony Mushrow3-May-05 20:46
professionalAnthony Mushrow3-May-05 20:46 
GeneralRe: Games and depth of objects - help =) Pin
Anonymous3-May-05 8:30
Anonymous3-May-05 8:30 
GeneralPiping data when using Process class Pin
CTaylor893-May-05 7:41
CTaylor893-May-05 7:41 
GeneralRe: Piping data when using Process class Pin
CTaylor893-May-05 11:48
CTaylor893-May-05 11:48 


View Message Thread (2 replies)

Results 1 - 3 of 3

Piping data when using Process class
From: Tenacious
Date Posted: 5/3/2005 12:22:00 PM



I have been trying to run this program called mysqlbinlog.exe from my
main c# application using the Process class(See example below). The way
that mysqlbinlog functions is to read the first file in the command
line and pipe the results to the second file.

This works fine when actually run from a command window on XP, but when
I try to execute mysqlbinlog from the process class, mysqlbinlog runs
but does not pipe the result to the second file. Can anybody see what I
may be doing wrong here, or is there some trick that I do not know
about. Any assistance or suggestions would be very much appreciated.

private void Form1_Load(object sender, System.EventArgs e)
{
//Declare and instantiate a new process component.
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();

process1.EnableRaisingEvents = false;

// Program file to run
string szProgFile = @"C:\Data\mysqlbinlog.exe";

// Cmd line arg to pipe results from rslog.001 to file1.txt
string strCmdLine = @"C:\Data\rslog.001 > C:\Data\file1.txt";

System.Diagnostics.Process.Start(szProgFile, strCmdLine);
process1.Close();
}

I received this answer from a post I made on another web site and it appears to have fixed the problem:
The problem is that the output redirect, when run from the command line, is performed by the cmd shell. Try altering your program as follows

// Program file to run
string szProgFile = Environment.SystemDirectory + @"\cmd.exe";

// Cmd line arg to pipe results from rslog.001 to file1.txt
string strCmdLine = @"/c C:\Data\mysqlbinlog.exe C:\Data\rslog.001
C:\Data\file1.txt";



Craig
GeneralKeep additional information inside a "serial number" Pin
eclipse2k13-May-05 7:33
eclipse2k13-May-05 7:33 
GeneralRe: Keep additional information inside a "serial number" Pin
mav.northwind3-May-05 23:36
mav.northwind3-May-05 23:36 
GeneralRe: Keep additional information inside a "serial number" Pin
eclipse2k14-May-05 1:57
eclipse2k14-May-05 1:57 
GeneralRe: Keep additional information inside a "serial number" Pin
mav.northwind4-May-05 3:24
mav.northwind4-May-05 3:24 
GeneralRe: Keep additional information inside a "serial number" Pin
eclipse2k14-May-05 3:43
eclipse2k14-May-05 3:43 
GeneralStrip Non-Numeric characters from string Pin
RadioButton3-May-05 7:20
RadioButton3-May-05 7:20 
GeneralRe: Strip Non-Numeric characters from string Pin
Judah Gabriel Himango3-May-05 8:27
sponsorJudah Gabriel Himango3-May-05 8:27 
GeneralRichTextControl and Unicode problems with russian characters Pin
Uwe Keim3-May-05 6:40
sitebuilderUwe Keim3-May-05 6:40 
GeneralRe: RichTextControl and Unicode problems with russian characters Pin
Judah Gabriel Himango3-May-05 8:10
sponsorJudah Gabriel Himango3-May-05 8:10 
GeneralRe: RichTextControl and Unicode problems with russian characters Pin
Uwe Keim3-May-05 8:44
sitebuilderUwe Keim3-May-05 8:44 
GeneralRe: RichTextControl and Unicode problems with russian characters Pin
mav.northwind3-May-05 23:41
mav.northwind3-May-05 23:41 
GeneralRe: RichTextControl and Unicode problems with russian characters Pin
Uwe Keim4-May-05 0:39
sitebuilderUwe Keim4-May-05 0:39 
QuestionProcedure line separator? Pin
Carl Mercier3-May-05 6:22
Carl Mercier3-May-05 6:22 
GeneralManaging controls added at runtime Pin
Anonymous3-May-05 5:07
Anonymous3-May-05 5:07 
GeneralRe: Managing controls added at runtime Pin
MoustafaS3-May-05 5:18
MoustafaS3-May-05 5:18 
GeneralPrinting HTML from memory no User interaction Pin
gjvh3-May-05 4:29
gjvh3-May-05 4:29 
GeneralDouble buffering an entire form... Pin
MynaBay3-May-05 4:23
MynaBay3-May-05 4:23 

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.