-
- Posts: 3
- Joined: 30 May 2013 13:42
Calling Visual Prolog from C
Hello! I have a programme written in Visual Prolog that I would like to use with a robot that understands only C. How can I call a Visual Prolog programme from C?
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
-
- Active Member
- Posts: 47
- Joined: 19 Sep 2011 8:54
-
- Posts: 3
- Joined: 30 May 2013 13:42
Re:
The prolog program receives some input data (a .txt file), processes it, then returns the result (as a different .txt file). So, the C program has to send the input data to Prolog and then recieve the output from it.Thomas Linder Puls wrote:I suppose that you want to do more than just start the Visual Prolog program?
Which interaction do you want/need between the two programs?
Do you have the sources for the Visual Prolog program or just the program?
I have all the sources.
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
In that case, it is actually C problems not Visual Prolog problem:l_jam wrote:The prolog program receives some input data (a .txt file), processes it, then returns the result (as a different .txt file). So, the C program has to send the input data to Prolog and then recieve the output from it.Thomas Linder Puls wrote:I suppose that you want to do more than just start the Visual Prolog program?
Which interaction do you want/need between the two programs?
Do you have the sources for the Visual Prolog program or just the program?
I have all the sources.
- Write the data to the txt file
- Start the Visual Prolog program
- Wait for termination of the Visual Prolog program
- Read the resulting txt file
In Visual Prolog (in useExe and syncObject) 2 and 3 are implemented by means of:
- CreateProcess which is not exactly the simplest function imaginable.
- The last argument contains a process handle that can be used with for example WaitForSingleObject to wait for program termination.
Regards Thomas Linder Puls
PDC
PDC
-
- Posts: 3
- Joined: 30 May 2013 13:42