Charles.Forsyth20060303-partialeea662d19 years agoHistory
60 lines · 1.3 KB · Text
RawDownload
.TH READNUM 10.2.SH NAMEreadnum, readstr \- return values from read from device.SH SYNOPSIS.ta \w'\fLchar* 'u.Bint readstr(ulong off, char *buf, ulong n, char *str).PP.Bint readnum(ulong off, char *buf, ulong n, ulong val, int size).SH DESCRIPTION.I Readstrand.I readnumsimplify the return of strings and numbers from device.I readroutines,because they deal with any buffering and boundary cases.Several parameters to the read call are often handed on directlyto these functions:the file offset, as.IR off ;the address of the user's buffer, as.IR buf ;and the number of bytes requested, as.IR n .Both functions return the number of bytes they have stored in.IR buf ,and which can often be returned directly from the device read routine..PP.I Readstrsatisfies a read by copying data into.I buffrom the NUL-terminated string in.IR str .The data transferred is selected and limited by.IR off ,.I nand the length of.IR str ..PP.I Readnumconverts the unsigned integer.I valto a decimal representation in.IR buf .The value is right-justified in a field of.IR size "-1"places and is followed by a blank..I Sizecan be the global constant.L NUMSIZEfor 32-bit integers;the largest.I sizeallowed is 64 bytes. .SH SOURCE.B /os/port/devcons.c.br.B /emu/port/devcon.c