Working with externals question

Alex Rice alex at mindlube.com
Tue Jan 20 23:34:27 EST 2004


On Jan 20, 2004, at 3:01 PM, Bojsza wrote:
>
> trigger -F test.cfg -r data.04

In transcript, no external required!
get shell("trigger -F test.cfg -r data.04")

If it really needs to be an external, then look at the standard library  
routine system().
	int result = system("trigger -F test.cfg -r data.04");
make sure to read `man system` for info about error signals and other  
considerations.

The system call doesn't return any data however.
	int result = system("trigger -F test.cfg -r data.04 > outputfile");
Then the stdout of trigger is put in outputfile.
sprintf() could be used to build up the arguments to the trigger  
command.

> Is the a way to tell if the external knows the existence of the  
> function or command?

Not sure if this is what you mean: See the UNIX command "which". It  
tells you if a command exists in the current PATH, and if so, what the  
location of the executable is. For example

which java
/opt/IBMJava2-14/bin/java

which nothing
which: no nothing in  
(/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/IBMJava2 
-14/bin:.)

--
Alex Rice | Mindlube Software | http://mindlube.com



More information about the use-livecode mailing list