Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I have a requirement for executing a C program within Mathematica. The user will provide the inputs and the expected results on a front end. Mathematica runs the C file, obtains the result for the provided inputs and compares with the user provided expected results. Further, a green pass button will be displayed if the results matched else a red failed button will be displayed. Later, I want to be able to do the same for C++, Python, Java, and Perl programs. Anyone has worked on this before ?

Warm regards, Anuk

share|improve this question

marked as duplicate by Yves Klett, cormullion, Leonid Shifrin, m_goldberg, halirutan Mar 6 '13 at 13:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
MathLink is your friend. –  Rolf Mertig Mar 6 '13 at 12:06
    
You can use .NET to load DLL in Mathematica reference.wolfram.com/mathematica/NETLink/tutorial/… –  user6227 Mar 6 '13 at 13:18

1 Answer 1

If you want to run an executable from within Mathematica, and read in the results, you can use the following syntax:

Import["!executablename", "someformat"]

The "!" indicates that the program will be run and the output read. Choose the appropriate format in Import. You can also use "!" with other input functions, such as ReadList.

For tighter integration with C, the answers here are exhaustive:

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.