TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tanvir Huda
NA
226
0
I have a wierd problem running a process. pls have a look at this .
Jan 6 2004 11:22 PM
Hello Guys, I am trying to run MSDOS fc.exe file using a process in C#. I have write down the following codes. I have also redirect the process's output so that i can read the output. The problem is when i run the program the following line of code suppose to return the output to the string s. s=proc.StandardOutput.ReadToEnd().ToString(); But it didn't return. But the wired thing is when i debug the program it works fine. i have no idea where is the problem the code is : string s="ABBFHFF"; string workDir=@"C:\Test Projects\Accumulator"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.UseShellExecute=false; //proc.EnableRaisingEvents=false; proc.StartInfo.WorkingDirectory=workDir; proc.StartInfo.FileName=@"fc"; proc.StartInfo.Arguments=@"C:\acc.xml C:\output.txt"; proc.StartInfo.WindowStyle=ProcessWindowStyle.Normal; proc.StartInfo.RedirectStandardOutput=true; try { //StreamReader sr=proc.StandardOutput; proc.Start(); s=proc.StandardOutput.ReadToEnd().ToString(); MessageBox.Show(s); MessageBox.Show(proc.StandardOutput.ReadToEnd()); proc.WaitForExit(); //MessageBox.Show(sr.ReadToEnd()); //sr.Close(); } catch(Exception ex) { MessageBox.Show(ex.ToString()); } MessageBox.Show(s.ToString()); For your kind informations fc is a dos program for comparing the content of the files. usually found in WIndows\System32 directory Thanks
Reply
Answers (
1
)
combo box
Crystal report connection through DSN in C#