Suppose we wish to print the first ten samples of record `100s'. (Record `100s' is the first minute of MIT-BIH Arrhythmia Database record `100', supplied as a sample with all source distributions of the DB Software Package. If you have only the MS-DOS binary version of the DB library on a CD-ROM, substitute the name of one of the records on your CD-ROM for `100s' in the program below.) We might begin by creating a source file called `psamples.c' that contains:
#include <ecg/db.h> main() { int i; DB_Sample v[2]; DB_Siginfo s[2]; if (isigopen("100s", s, 2) < 1) exit(1); for (i = 0; i < 10; i++) { if (getvec(v) < 0) break; printf("%d\t%d\n", v[0], v[1]); } exit(0); }
All programs that use the DB library must include the statement
#include <ecg/db.h>
which defines function interfaces, data types (such as the
DB_Sample
and DB_Siginfo
types used in this example), and
a few useful constants. (Most MS-DOS C compilers accept `/' as a
directory separator. If you prefer to use the non-portable `\'
under MS-DOS, remember to quote it: `#include <ecg\\db.h>'.)
The functions used in the example are described in detail in the next
chapter, and the data types are described in the following chapter
(see section Data Types). For now, note that isigopen
prepares a
record to be read by getvec
, which reads a sample from each of
the two signals each time it is called.
Go to the first, previous, next, last section, table of contents.