Tag Info

Hot answers tagged

11

You will find a complete, step by step description of how to write such a program here. Here's a small test program that adds 42 and 137, written by following the tutorial closely: /* mlcall.c */ #include <mathlink.h> #include <stdio.h> int main(int argc, char *argv[]) { MLENV env; MLINK link; int errno; int packet; env = ...


8

The problem has nothing to do with OpenWrite. You never Close the stream you open in your call to Read. Read, unlike ReadList, does not automatically close a stream (file, pipe, etc.) that's given as its first argument string. (That's because the purpose of Read is to be able to read from the same source in pieces, unlike ReadList which does it all at ...


8

The number 2045 is suspicious. Add three to it to include stdin, stdout, and stderr, and you get 2048, which I suspect is total number of file descriptors available to you. I conclude your problem is caused by eating up all the available file descriptors. This is usually caused by doing too many file opens without doing any file closings to return some file ...


6

The command Run will do exactly that. For example, try Run["touch ~/Desktop/blankfile"] If you want to read the results back in, there are a few options, and the choice between them depends on exactly what you want to do. The RunThrough command lets you read the output of a command-line back as a Mathematica expression. For example, try ...


2

I faced the same problem but I was told here that it was impossible. So, looking for other alternatives I've found it! It's called CoolProp. Given the source files and a Mathematica link file, you need to build a Mathematica-compatible CoolProp.dll yourself. Get them from GitHub Now, I can use it with ease.


2

I googled ".net change working directory", and this link to Microsoft's .NET docs was the first hit: http://msdn.microsoft.com/en-us/library/system.io.directory.setcurrentdirectory(v=vs.110).aspx. It would suggest the following: LoadNETType["System.IO.Directory"] Directory`SetCurrentDirectory["c:\\foo"] To find out the current working directory: ...


1

As Anon pointed out, my problem was more of a poor knowledge of Unix rather than incomplete Mathematica chops, and a judicious use of pipes solves the issue. Thus, instead of exporting a string to a file and using that as an input, as I had, inputstring="sample input data"; Export["inputFile.txt",inputstring,"Text"] inputstream=OpenRead["! ...


1

On Linux you can add the directory containing this library to LD_LIBRARY_PATH. A semi-automated way to do this from a command prompt is this: MATHLINK=$(dirname $(readlink -f $(which math)))/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MATHLINK You can use this merthod of detecting ...



Only top voted, non community-wiki answers of a minimum length are eligible