Go to the first, previous, next, last section, table of contents.


osigopen

int osigopen(char *record, DB_Siginfo *siarray, unsigned int nsig)

Return:

>0
Success: the returned value is the number of output signals; this number should match nsig
-1
Failure: unable to read `header' file
-2
Failure: incorrect `header' file format
-3
Failure: unable to open output signal(s)

This function opens output signal files. Use it only if signals are to be written using putvec. The signal specifications, including the file names, are read from the `header' file for a specified record. Unmodified MIT or AHA database `header' files cannot be used, since osigopen would attempt to overwrite the (write-protected) signal files named within. If record begins with `+', previously opened output signal files are left open, and the record name is taken to be the remainder of record after discarding the `+'. Otherwise, osigopen closes any previously opened output signal files, and takes all of record as the record name. If the record name is `-', osigopen reads the standard input rather than a `header' file. siarray is a pointer to an uninitialized array of DB_Siginfo structures; siarray must contain at least nsig members. The caller must allocate storage for the DB_Siginfo structures. On return, osigopen will have filled in the DB_Siginfo structures with the signal specifications.

No more than nsig (additional) output signals will be opened by osigopen, even if the `header' contains specifications for more than nsig signals. For example, this code fragment

...
DB_Siginfo s[2];
int i, nsig;

nsig = osigopen("8l", s, 2);
for (i = 0; i < nsig; i++)
    printf("signal %d will be written into `%s'\n", i, s[i].fname);
...

creates 2 output signals named `data0' and `data1' (see section Piped and Local Records). See section Example 6: A Differentiator, and see section Example 7: A General-Purpose FIR Filter, for illustrations of the use of osigopen.

As a special case, if nsig is 0, siarray can be NULL. This can be useful to force open output signal files to be closed without closing open annotation or input signal files.


Go to the first, previous, next, last section, table of contents.



George B. Moody (george@hstbme.mit.edu)