HP 9000 Series 300 Tutorials Manual page 36

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

Calls to
read
have the form:
#include <fcntl.h>
#include <errno.h>
main()
{
int
eid;
I*the
entity identifier*1
char buffer [10] ;
I*buffer in which the read data will be placed*1
i f
«eid
=
open(1I Idev/raw_hpib" ,
O_RDWR»
==
-1) {
printf("open failed, errno
=
%d\n", errno);
exit(2);
}
io_reset(eid);
io_timeout_ctl(eid, 1000000);
I*establish communication with the raw HP-IB device file
as described in Chapter 3, "Controlling the HP-IB interface"*1
read(eid, buffer, 10);
I*reads 10 bytes from a previously opened*1
}
I*file with the entity identifier "eid " .
*1
Calls to
write
are very similar:
#include <fcntl.h>
#include <errno.h>
mainO
{
}
int
eid;
I*the
entity identifier*1
char *buffer;
1*
the buffer containing data to be written to a file*1
if
«eid
=
open ("/dev/raw_hpib",
O_RDWR»
==
-1) {
}
printf("open failed, errno
=
%d\n", errno);
exit(2);
io_reset(eid) ;
io_timeout_ctl(eid, 1000000);
I*establish communication with the HP-IB interface as described
in Chapter 3, "Controlling the HP-IB Interface"*1
buffer
=
"data message";
write(eid, buffer, 12);
I*message to be
sent*1
1*12
bytes are written to previously*1
I*opened file with the entity identifier "eid"*1
2-8
General-Purpose Routines

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents