SKILL–C++ Interaction
From: Cadence Community PCB SKILL forum post
I am developing a SKILL program which has to interact with an executable written in C++. How can I run the external command, and get at the results?
I have tried the following, which was suggested by another poster:
system("program arg1 arg2...")
but that doesn’t seem to work.
From: Damien Diederen <dd@crosstwine.com>
Date: Wed, 16 Jan 2013 00:54:04 +0100
Hi mostly anonymous,
I can confirm that system("program arg1 arg2...")
should
work.
One thing which might be going wrong is that under Windows,
reverse solidus (\
) characters have to be doubled in
literal strings, as they otherwise clash with the SKILL escape
mechanism:
system("e:\\work\\program.exe arg1 arg2...")
Another thing to watch out for is spaces in the path to the binary;
I’m not even sure about the proper quoting mechanism under Windows… the
following might work, but I’d double check the docs for
cmd.exe
:
system("\"c:\\Program Files\\My\\Program.exe\" arg1 arg2...")
(And similarly for the arguments.)
Another solution, which offers more control—but suffers from the same
quoting madness—would be to use the ipc*
family of
functions (ipcBeginProcess
, etc.). I have put together a
small example at:
http://s.crosstwine.com/spb/d2692740
and you will find a complete package attached to this message (tested under Linux). [Unpacked here -Ed.]
Hope this helps,
Damien