5.2.9.5 read()
The routine read() reads a number of bytes (less than or equal to maxbytes) from a
speci?¬?ed ?¬?le descriptor and places them in a buffer. It calls the device driver to do the
work.
The return value is the number of bytes read (between 1 and maxbytes, 0 if end of ?¬?le), or
ERROR if the ?¬?le descriptor does not exist, the driver does not have a read routine, or the
driver returns ERROR. If the driver does not have a read routine, errno is set to NOTSUP.
5.2.9.6 write()
The routine write() writes a number of bytes from buffer to a speci?¬?ed ?¬?le descriptor. It
calls the device driver to do the work.
106 RFID Handbook: Applications, Technology, Security, and Privacy
The return value is the number of bytes written, or ERROR if the ?¬?le descriptor does not
exist, the driver does not have a write routine, or the driver returns ERROR. If the driver
does not have a write routine, errno is set to NOTSUP.
The precise meaning of reading or writing from or to a device depends on the nature of
the device. For example, writing to an RF driver causes the data to be modulated over the
output RF signal, and reading from the RF driver ?¬?lls an input buffer with samples from an
ADC chip. Reading and writing to or from some devices might be illegal. For example,
reading from the transmitter and writing to the receiver driver are illegal operations.
Pages:
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222