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


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.


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:


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