Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help with the run an executable program of a number of times

Help with the run an executable program of a number of times

Scheduled Pinned Locked Moved C#
questioncsharphelp
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anka_Ame
    wrote on last edited by
    #1

    I need to run an executable program from a C# program and I need to run the program of a a number of times and I have to save the output each time. I tried something but it saves my only the last output. How can I do it?

    J K L L 4 Replies Last reply
    0
    • A Anka_Ame

      I need to run an executable program from a C# program and I need to run the program of a a number of times and I have to save the output each time. I tried something but it saves my only the last output. How can I do it?

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      You can use System.Diagnostics.Process class to run external programs. You can use Process.StandardOutput to get the output of each process.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Trekkie love The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      1 Reply Last reply
      0
      • A Anka_Ame

        I need to run an executable program from a C# program and I need to run the program of a a number of times and I have to save the output each time. I tried something but it saves my only the last output. How can I do it?

        K Offline
        K Offline
        kubben
        wrote on last edited by
        #3

        If you use the process class you can execute your application. If you tie into the standard output you can receive that output and do stuff with it. I have an example of this in this article I wrote: http://www.codeproject.com/dotnet/OpenFiles.asp[^] Hope that helps. Ben

        A 1 Reply Last reply
        0
        • K kubben

          If you use the process class you can execute your application. If you tie into the standard output you can receive that output and do stuff with it. I have an example of this in this article I wrote: http://www.codeproject.com/dotnet/OpenFiles.asp[^] Hope that helps. Ben

          A Offline
          A Offline
          Anka_Ame
          wrote on last edited by
          #4

          I am already using Process class to run the executable program. The output files are created by the arguments given to the executable program. I tried to give a different name to the output each time. I am runing the program with the help of a cycle. And the input changes name in each cycle and the output the same. But the only thing it's saved it is the last output. How can I solve this?

          M 1 Reply Last reply
          0
          • A Anka_Ame

            I am already using Process class to run the executable program. The output files are created by the arguments given to the executable program. I tried to give a different name to the output each time. I am runing the program with the help of a cycle. And the input changes name in each cycle and the output the same. But the only thing it's saved it is the last output. How can I solve this?

            M Offline
            M Offline
            Manoj Kumar Rai
            wrote on last edited by
            #5

            You can try this a simple solution. For the output take a fixed name say "simpleoutput". Now when you run your executable it should create a file name using the above fixed name and the courrent name i.e. outputFileName = "simpleoutput" + value. So you will get the unique file name. Your executable should write in these files.

            Manoj Never Gives up

            1 Reply Last reply
            0
            • A Anka_Ame

              I need to run an executable program from a C# program and I need to run the program of a a number of times and I have to save the output each time. I tried something but it saves my only the last output. How can I do it?

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              sounds like a bug in your code. Care to show code ? :)

              Luc Pattyn [My Articles] [Forum Guidelines]

              1 Reply Last reply
              0
              • A Anka_Ame

                I need to run an executable program from a C# program and I need to run the program of a a number of times and I have to save the output each time. I tried something but it saves my only the last output. How can I do it?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Anka_Ame wrote:

                saves my only the last output

                Are you, by chance, creating the file each time and not appending to the file? Creating the file each time you save would seem like it only saves the last value. If you want all of the values in the same file, you need to append the values in the file.

                Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups