title: Buffer Jlink.exe
body: <p>Such a problem
  The application (Jlink.exe) writes to the buffer, and until the buffer is full, no data is displayed. If you exit the application, the buffer is flushed to the console.
  How can i fix this? How to display data without leaving the application (Jlink.exe).</p>
  <pre><code>public partial class MainWindow : Window
  {
      Process jLinkProcess = new Process();
      
      public MainWindow()
      {
          InitializeComponent();
      }
  
      private void Window_Loaded(object sender, RoutedEventArgs e)
      {
          jLinkProcess.StartInfo = new ProcessStartInfo(@&quot;C:\Program Files\SEGGER\JLink\JLink.exe&quot;);
          jLinkProcess.StartInfo.UseShellExecute = false;
          jLinkProcess.StartInfo.RedirectStandardInput = true;
          jLinkProcess.StartInfo.RedirectStandardOutput = true;
          jLinkProcess.StartInfo.RedirectStandardError = true;
          jLinkProcess.StartInfo.CreateNoWindow = true;
          jLinkProcess.OutputDataReceived += jLinkProcess_OutputDataReceived;
          jLinkProcess.ErrorDataReceived += jLinkProcess_ErrorDataReceived;
          jLinkProcess.Start();
          jLinkProcess.BeginOutputReadLine();
          jLinkProcess.BeginErrorReadLine();
          jLinkProcess.StandardInput.WriteLine(&quot;connect&quot;);
          jLinkProcess.StandardInput.WriteLine(&quot;NRF52811_XXAA&quot;);
          jLinkProcess.StandardInput.WriteLine(&quot;SWD&quot;);
          jLinkProcess.StandardInput.WriteLine(&quot;4000&quot;);
      }
  
      private void jLinkProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
      {
          Dispatcher.Invoke(() =&gt;
          {
              TextBox2.Text += e.Data + &quot;\r\n&quot;;
              TextBox2.ScrollToEnd();
          });
      }
  
      private void jLinkProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
      {
          Dispatcher.Invoke(() =&gt;
          {
              TextBox2.Text += e.Data + &quot;\r\n&quot;;
              TextBox2.ScrollToEnd();
          });
      }
  
      private void TextBox1_PreviewKeyDown(object sender, KeyEventArgs e)
      {
          if (sender is TextBox textBox &amp;&amp; e.Key == Key.Enter)
          {
              jLinkProcess.StandardInput.WriteLine(textBox.Text);
              textBox.Text = string.Empty;
              e.Handled = true;
          }
      }
  
      private void ReadMemory(object sender, RoutedEventArgs e)
      {
          string mac = &quot;mem 10000060,8&quot;;
          jLinkProcess.StandardInput.WriteLine(mac);
      }
  }
  </code></pre>