Solved

calling a process (external) in a loop

Posted on 2009-07-14
4
158 Views
Last Modified: 2013-12-17
Hello group,

I've started writing a code in C# and there is a step that I have to read a directory full of PDF and convert them to Text (using an open source). In fact, I am calling a process within a loop.

I'm worry that would cause issue sometimes or ... any idea or advice will be appreciated.

Regards,

in the loop:
 
{
                    Process p = new Process();
 
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardInput = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = "C:\\test\\pdftotext.exe";
                    p.StartInfo.Arguments =  strPDFIn + " " + strTestOut;
                    p.Start();
 
  }

Open in new window

0
Comment
Question by:akohan
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24859585
What kind of "advice" do you need?  What kind of problems do you foresee?  Do you need to wait for the process to complete before moving on to the next process?  Does each process work on its own .pdf file and output?
0
 

Author Comment

by:akohan
ID: 25170969


Yes, I need to know how I can make it wait to process 1 gets complete.

Regards,
ak
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 25172659
You can use something like this:

p.WaitForExit();

    -- or --

p.WaitForExit(10000);    // Timeout after 10 seconds.
0
 

Author Comment

by:akohan
ID: 25173792


Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with adding DLL file in Windows project 20 40
Help with error in Query 2 31
Open a link in vb.net 2 16
Name Space error VS2015 1 24
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question