Page 1 of 1

& character into filename and pathname

Posted: Tue Nov 18, 2008 3:03 pm
by rumbao
Dear Sir,

Our filesystem have the "&" character into filenames and folder names. When I try to open a model calling vensim_command from my C++ application and the model name or the folder name has the "&" character, vensim does not find the model to open. But when I open the model via model reader application, navigating between folders, there is no problem to open it.

My calling function is:

vensim_command("SPECIAL>LOADMODEL|c:\vensim\Projects\prueba&veras\empty.vpm")

Thank you
Jose Fornes

Posted: Wed Nov 19, 2008 7:28 am
by Administrator
Have you tried something like

vensim_command("SPECIAL>LOADMODEL|c:\\vensim\\Projects\\prueba&veras\\empty.vpm")

Tony.

Posted: Wed Nov 19, 2008 3:54 pm
by rumbao
Yes I tried it:

vensim_command("SPECIAL>LOADMODEL|c:\\vensim\\Projects\\prueba&veras\\empty.vpm")

And I have the error:

Stop from Vensim
The model c:\Vensim\Projects\prueba.vmf does not exist - can“t open.

It seems to stop it reading filename when it finds & character and it adds ".vmf" at the end.

Posted: Thu Nov 20, 2008 12:34 pm
by bob@vensim.com
The & is used to separate Vensim commands. So Vensim is getting two command

SPECIAL>LOADMODEL|c:\vensim\Projects\prueba

and

veras\\empty.vpm

the second one does not make any sense but it fails on the first anyway so it never gets there.

There is not an escape sequence for & - I will take a look to see if one can be added.

Posted: Thu Nov 20, 2008 3:45 pm
by rumbao
Thank you for your answer
I will look forward an escape sequence.

Jose Fornes

Posted: Fri Nov 21, 2008 12:11 pm
by bob@vensim.com
Hi Jose,

This will be in the next release and done by using quotes around options as in

SPECIAL>LOADMODEL|"c:\vensim\projects\prueba&veras\empty.vpm"

so in C the command would be

vensim_command("SPECIAL>LOADMODEL|\"c:\\vensim\\Projects\\prueba&veras\\empty.vpm\"")

Posted: Fri Nov 21, 2008 5:45 pm
by rumbao
Thank you