cscpi_exe_fildes()
NAME
cscpi_exe_fildes − Compiled SCPI Function
SYNOPSIS
cscpi_exe_fildes (id, in, out);
DESCRIPTION
The C-SCPI execute file descriptor function (HP-UX 9.0 or later ONLY) allows you to specify a file descriptor as an input file or pipe that contains SCPI commands to be executed. The results of the executed SCPI commands are put into the file descriptor specified for output. This function only works with REGISTER configurations. With this function the SCPI commands are parsed and executed at runtime.
PARAMETERS
id
The user variable name for the instrument. This is the variable name that you assign to the instrument in the INST_DECL or INST_EXTERN command. For example,
INST_DECL (vm, "E1411B", REGISTER);
assigns vm as an instrument data pointer to the E1411B. Now when you use vm as the id in cscpi_exe_fildes, the SCPI command is sent to the HP E1411B.
in
An integer as the file descriptor to determine the input file. This file needs to contain SCPI commands to be executed. The SCPI commands must be for the REGISTER configured instrument specified in the id parameter.
out
An integer as the file descriptor to determine the output file. The results from the executed SCPI commands are stored in this file.
COMMENTS
Since 0 (stdin), 1 (stdout), and 2 (stderr) can be used, you can do terminal I/O without having to open extra files.
ONLY SCPI commands for the instrument specified in the id parameter can be used in the input file.
The input and output may be piped or redirected to other controlling processes. Connecting stdin (0) and stdout (1) to pipes allows you to have a separate process that is independent of SCPI or C-SCPI. See "Programming on HP-UX" for more information on piping or redirecting to other processes.
EXAMPLE
This example uses the stdin (0) and stdout (1) file descriptors with cscpi_exe_fildes. The user can enter the SCPI commands from the terminal keyboard and the results are displayed on the terminal screen. The program continues until the user enters a Ctrl D which indicates the end of the file.
INST_DECL (vm, "E1411B", REGISTER);
main ()
{
INST_STARTUP ();
INST_OPEN (vm, "VXI,24");
printf ("Enter SCPI Commands for E1411B. Enter Ctrl D to quit0);
cscpi_exe_fildes (vm, 0, 1);
printf ("Done0);
}
— December 08, 1992