📄 eof.gml
字号:
.func eof
#include <&iohdr>
int eof( int &fd );
.ixfunc2 '&OsIo' &func
.funcend
.desc begin
The &func function determines, at the operating system level, if the
end of the file has been reached for the file whose file &handle is
given by
.arg &fd..
Because the current file position is set following an input operation,
the &func function may be called to detect the end of the file before
an input operation beyond the end of the file is attempted.
.desc end
.return begin
The &func function returns 1 if the current file position is at the
end of the file, 0 if the current file position is not at the end.
A return value of &minus.1 indicates an error, and in this case
.kw errno
is set to indicate the error.
.return end
.error begin
.begterm 12
.term EBADF
The
.arg &fd
argument is not a valid file &handle..
.endterm
.error end
.see begin
.seelist eof read
.see end
.exmp begin
#include <stdio.h>
#include <fcntl.h>
#include <&iohdr>
void main()
{
int &fd, len;
char buffer[100];
.exmp break
&fd = open( "file", O_RDONLY );
if( &fd != -1 ) {
while( ! eof( &fd ) ) {
len = read( &fd, buffer, sizeof(buffer) - 1 );
buffer[ len ] = '\0';
printf( "%s", buffer );
}
close( &fd );
}
}
.exmp end
.class WATCOM
.system
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -