User guide
40
6000 Series Programmer's Guide
Download from the
Application Program
This section describes how to download from C and PASCAL programs.
Downloading from a C Program: To download the operating system from a C
program, a child process must be created. The C command spawnl is used to create a child
process in which the operating system is downloaded (see code example below).
#include <stdio.h>
#include <process.h>
void main()
{
int error_code = 0;
char *pathname = "C:\\AT6nnn\\AT6nnn.EXE";
char *args[] = { "AT6nnn.EXE",
"C:\\AT6nnn\\AT6nnn.OPS",
"/port=768",
"/quiet",
NULL
};
error_code=spawnl(P_WAIT,pathname,args[0],args[1],args[2],args[3],NULL);
if(error_code==-1) {
printf("Could not locate AT6nnn operating system\n");
exit(0);
}
else if (error_code > 0) {
printf("Failed to download AT6nnn operating system\n");
exit(0);
}
}
Downloading from PASCAL: To download the operating system from a PASCAL
program, a separate process must be executed. The PASCAL command exec is used to run a
separate process in which the operating system is downloaded (see code example below).
Program download;
uses Crt;
begin
swapvectors;
exec('\AT6nnn\AT6nnn.EXE','AT6nnn \AT6nnn\AT6nnn.OPS /port=768 /quiet');
swapvectors;
if Doserror <> 0 then
begin
writeln('Dos error #',Doserror);
end;
end.










