fgetchar.gml

来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 94 行

GML
94
字号
.func fgetchar _fgetchar _fgetwchar _ufgetchar
.funcw _fgetwchar
#include <stdio.h>
int fgetchar( void );
.ixfunc2 '&StrIo' &func
.if &'length(&_func.) ne 0 .do begin
int _fgetchar( void );
.ixfunc2 '&StrIo' &_func
.do end
.if &'length(&wfunc.) ne 0 .do begin
wint_t _fgetwchar( void );
.ixfunc2 '&StrIo' &wfunc
.ixfunc2 '&Wide' &wfunc
.do end
.if &'length(&ufunc.) ne 0 .do begin
int _ufgetchar( void );
.ixfunc2 '&StrIo' &ufunc
.do end
.funcend
.desc begin
The &func function is equivalent to
.kw fgetc
with the argument
.kw stdin.
.if &'length(&_func.) ne 0 .do begin
.np
The &_func function is identical to &func..
Use &_func for ANSI naming conventions.
.do end
.if &'length(&wfunc.) ne 0 .do begin
.np
The &wfunc function is identical to &func except that it gets the next
multibyte character (if present) from the input stream pointed to by
.kw stdin
and converts it to a wide character.
.do end
.if &'length(&ufunc.) ne 0 .do begin
.np
The &ufunc Unicode function is identical to &func except that it returns
a Unicode character.
.do end
.desc end
.return begin
The &func function returns the next character from the input stream
pointed to by
.kw stdin.
If the stream is at end-of-file, the end-of-file indicator is set and
&func returns
.kw EOF.
If a read error occurs, the error indicator is set and
&func returns
.kw EOF.
.if &'length(&wfunc.) ne 0 .do begin
.np
The &wfunc function returns the next wide character from the input
stream pointed to by
.kw stdin.
If the stream is at end-of-file, the end-of-file indicator is set and
&wfunc returns
.kw WEOF.
If a read error occurs, the error indicator is set and &wfunc returns
.kw WEOF.
If an encoding error occurs,
.kw errno
is set to
.kw EILSEQ
and &wfunc returns
.kw WEOF.
.do end
.np
.im errnoref
.return end
.see begin
.seelist &function. fgetc fgetchar fgets fopen getc getchar gets ungetc
.see end
.exmp begin
#include <stdio.h>

void main()
  {
    FILE *fp;
    int c;
.exmp break
    fp = freopen( "file", "r", stdin );
    if( fp != NULL ) {
      while( (c = fgetchar()) != EOF )
        fputchar(c);
      fclose( fp );
    }
  }
.exmp end
.class WATCOM
.system

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?