I want to execute a prolog file when the user click the 'Enter' button in a windows 8 application. Can I execute a separate prolog file or do I need to write the prolog code in the middle of my C# codes. I'm using visual studio 2013 and SWI prolog.
I want to do this because I'm developing an application which takes an arithmetic equation as the user input, use prolog to solve it and output the answer.
I recommend using the regular Windows desktop environment rather than Windows Store (which I see in the question tags). Windows store apps have a lot of restrictions to prevent people from creating malicious apps, and that will prevent you from launching the Prolog app.
But with a desktop app, you could start the Prolog interpreter in its own process, with the standard-input and standard-output streams redirected. You could then send content to the Prolog process via the input stream, and relay the output stream of the Prolog process to a text box in your C# WinForms app.
This sample at MSDN shows how to redirect the standard-output stream of a process:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput%28v=vs.110%29.aspx
And with some minor changes to suit your needs:
You could also create a DLL version of the Prolog code, which you could load into your C# app, however this will take more work and I doubt that there is enough benefit to justify that extra work.