Under windows 98 the following cpp program will execute system commands
from the REBOL console. If the version of dos used supports redirections,
the output, if any, will appear on the console screen. If not, the results
will appear in the dos box from which command.exe has been invoked. I use
4dos, which does support redirection. The cpp file was compiled using
Borland C++.
Jerry
// command.cpp
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
void main()
{
FILE *fp;
while(5==5)
{
sleep(2);
if (fp = fopen("f.bat","rt"))
{
system("f.bat >& c.txt");
fclose(fp);
sleep(2);
system("erase f.bat");
}
}
}
The REBOL function to invoke the system call is:
dos: func [cmd][
write %f.bat cmd
wait 2
print read %c.txt
exit
]