Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: SetDirectory with mathlink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15108] Re: SetDirectory with mathlink
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 12 Dec 1998 03:59:09 -0500
  • Organization: Universitaet Leipzig
  • References: <74o0t9$497@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Witold,

the first and most portable version is to use the $PathnameSeparator
variable.

So You can write
MLPutFunction(link,"SetDirectory",1);
  MLPutFunction(link,StringJoin,3);
    MLPutByteString(link,"C:");
    MLPutSymbol(link,"$PathnameSeparator");
    MLPutByteString(link,"Programme");

The second version uses MLEvaluateString() and  looks like

MLEvaluateString(link,"SetDirectory[\"C:\"<>$PathnameSeparator<>\"Programme\"]");

It is not clear why you use the old (undocumented) EnterTextPacket[]
function.

Hope that helps
  Jens


wgrebe wrote:
> 
> Hallo,
> I have the following problem:
> I write a program in C and use Mathematica via MathLink. I try to send
> the command 'SetDirectory["C:\\Programme"]' to Mathematica via an
> EnterTextPacket. I think the problem are the quotation marks. Of course
> when I type in
> 
> MLPutString( link, "SetDirectory["C:\\Programme"]");
> 
> the program  cannot be built. So I use the escape sequence ' \ ':
> 
> MLPutFunction( link, "EnterTextPacket", 1); MLPutString( link,
> "SetDirectory[\"C:\\Programme\"]"); MLEndPacket( link);
> 
> Unfortunately this doesn't work either. What is wrong?
> Thank you
>                                                             Witold
> wgrebe at cityweb.de


  • Prev by Date: Re: $Path variable
  • Next by Date: Re: Simple MathLink question
  • Previous by thread: SetDirectory with mathlink
  • Next by thread: Two questions---nonevaluated Integrate; NIntegrate inside NDSolve