putw.gml

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

GML
55
字号
.func _putw
#include <stdio.h>
int _putw( int binint, FILE *fp );
.ixfunc2 '&StrIo' &func
.funcend
.desc begin
The &func function writes a binary value of type
.us int
to the current position of the stream
.arg fp.
&func does not affect the alignment of items in the stream, nor does
it assume any special alignment.
.np
&func is provided primarily for compatibility with previous libraries.
Portability problems may occur with &func because the size of an
.us int
and the ordering of bytes within an
.us int
differ across systems.
.desc end
.return begin
The &func function returns the value written or, if a write error
occurs, the error indicator is set and &func returns
.kw EOF.
Since
.kw EOF
is a legitimate value to write to
.arg fp,
use
.kw ferror
to verify that an error has occurred.
.return end
.see begin
.seelist &function. ferror fopen fputc fputchar fputs
.seelist &function. putc putchar puts _putw
.see end
.exmp begin
#include <stdio.h>

void main()
  {
    FILE *fp;
    int c;
.exmp break
    fp = fopen( "file", "r" );
    if( fp != NULL ) {
      while( (c = _getw( fp )) != EOF )
          _putw( c, stdout );
      fclose( fp );
    }
  }
.exmp end
.class WATCOM
.system

⌨️ 快捷键说明

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