Advertisement
fcamuso

Un assaggio di Prolog - video 6

Mar 22nd, 2025
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Diagnostics;
  11.  
  12. namespace WinProlog
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.        
  17.         public Form1()
  18.         {
  19.             InitializeComponent();             
  20.         }
  21.  
  22.         private void button1_Click(object sender, EventArgs e)
  23.         {
  24.             richTextBox1.Clear();
  25.  
  26.             Process prolog = new Process();
  27.             prolog.StartInfo.FileName = "swipl";
  28.             string path = AppDomain.CurrentDomain.BaseDirectory.Replace(@"\", @"\\");
  29.             prolog.StartInfo.Arguments = "-q -g \"consult('" + path + "parenti.pl'), " + textBox1.Text + ", halt\"";
  30.            
  31.             prolog.StartInfo.RedirectStandardOutput = true;
  32.             prolog.StartInfo.UseShellExecute = false;
  33.             prolog.StartInfo.CreateNoWindow = true;
  34.  
  35.             prolog.Start();
  36.             string output = prolog.StandardOutput.ReadToEnd();
  37.             prolog.WaitForExit();
  38.  
  39.             richTextBox1.Text = output;
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement