C# Process issue

Asked by At

Well I have 2 Applications and I want to send messages from my first app to my second :

this is the application which handles my second application:

enter code here

Console.WriteLine("Set Process and Process Start Info");

        string arr = Console.ReadLine();

        var array = arr.Split('/');

        string processname = array[0];

        string processstartinfo = array[1];

        Process p = new Process();

        p.StartInfo.FileName = processname;

        File.WriteAllText("commandtext.txt", processstartinfo);

        p.Start();

and this is my second application

enter code here

   var line = File.ReadAllText("commandtext.txt");

        Console.WriteLine(line);





        Thread.Sleep(3000);

But the output every time I run the simulation doesnt show me anything . Where am I wrong?

1 Answers

-1
Max Destiny On

I did it! You just need to use file streams instead the abstract class File and close the filestream after you use it , use FileMode.Create so every time a new file is created in the place of the old file , and use FileMode.Open to read the data