📄 getc.3
字号:
.th GETC III 4/30/72.sh NAMEgetc, getw, fopen \*- buffered input.sh SYNOPSIS.ft Bmov $filename,r0.brjsr r5,fopen; iobuf.s3fopen(filename, iobuf).brchar *filename;.brstruct buf *iobuf;.s3jsr r5,getc; iobuf.br.ft R(character in r0).s3.ft Bgetc(iobuf).brstruct buf *iobuf;.s3jsr r5,getw; iobuf.br.ft R(word in r0).s3.ft Bgetw(iobuf).brstruct buf *iobuf;.ft R.sh DESCRIPTIONThese routines provide a buffered inputfacility..it Iobufis the address of a 518(10) byte buffer area whosecontents are maintained by these routines.Its structure is.s3.nf.ft B struct buf { int fildes; /* File descriptor */ int nleft; /* Chars left in buffer */ char *nextp; /* Ptr to next character */ char buff[512]; /* The buffer */ };.ft R.s3.fi.it Fopenmay be called initially to open the file. On return,the error bit (c-bit) is set if the open failed.If \fIfopen\fR is never called, \fIget\fR willread from the standardinput file.From C, the value is negative if the open failed..s3.it Getcreturns the next byte from the file in r0.The error bit is set on end of file or a read error.From C, the character is returned as an integer, without sign extension;it is \*-1 on end-of-file or error..s3\fIGetw\fR returns the next word in r0..it Getcand\fIgetw\fRmay be used alternately; there are no odd/evenproblems.\fIGetw\fR is may be called from C;\*-1 is returned on end-of-file or error,but of courseis also a legitimate value..s3.it Iobufmust be provided by the user; it must be on a word boundary..s3To reuse the same buffer for another file, it is sufficientto close the original file and call \fIfopen\fR again..sh "SEE ALSO"open (II), read (II), getchar (III), putc (III).sh DIAGNOSTICSc-bit set on EOF or error;from C, negative return indicates error or EOF.Moreover,.it errnois set by this routine just as it is for a system call(see introduction (II))..sh BUGS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -