Return to Statement


Execute Operating System Function Example

The following GRIP and C program illustrate the writing of a program that receives arguments from a GRIP program and passes data back to the GRIP program. The result of this program is to print the message "'testing a long argument string into a GRIP xspawn program'" on the window Unigraphics was started from, and to print the message "back to GRIP" on the Unigraphics listing device.

   xspawn.grs
string/arglst(127),retdat(127)
arglst = 'testing a long argument string into a grip xspawn program'
xspawn/prog,'test',arglst,result,retdat
print/retdat
halt

test.c
#include <stdio.h>
#include <string.h>

int uc4622(char *);

int main(int argc, char *argv[])
{
char **argptr = argv + 1;
char **endptr = argv + argc -1;
char *str = "back to GRIP";
int ier = 0;

for(; argptr <= endptr; argptr++)
printf("%s%c", *argptr, (argptr < endptr) ? ' ' : '\n');
ier = uc4622(str);
if(ier > 0)
{
printf("CFI error number is: %d", ier);
}
return 0;
}