на русском
enterregistration
On indexSite map
Ready-made QNX drivers.
§2. Operating with a driver
[contents][print version]

It is very easy to work with a driver:

#include ‹stdio.h›
#include ‹errno.h›
#include ‹S_libdrvio.h›

int main(int argc, char* argv[]){
 char* path_drv = "/dev/PCL-818H";
 drv_t drv;
 float data;

 /* 1 - open a driver /
 if ((drv = drv_open(path_drv)) == NULL) {
  fprintf(stderr, "Can't open driver (%s)\n", 
          strerror(errno));
  exit(1);
 }

 /* 2 - read analog data of 0 –channel */
 if(drv_analog_read(drv,0,0,&data)){
  fprintf(stderr, "Error reading data (%s)\n", 
          strerror(errno));
 }

 /* 3 - close */
 drv_close(drv);
 return 0;
}

As one can notice to receive for instance analog data from the driver it is necessary to implement a sequence of three library enquiries: drv_open(), drv_analog_read(), drv_close().