eof.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:2k
- '"
- '" Copyright (c) 1993 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: eof.n,v 1.4.8.1 2004/10/27 09:35:38 dkf Exp $
- '"
- .so man.macros
- .TH eof n 7.5 Tcl "Tcl Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- eof - Check for end of file condition on channel
- .SH SYNOPSIS
- fBeof fIchannelIdfR
- .BE
- .SH DESCRIPTION
- .PP
- Returns 1 if an end of file condition occurred during the most
- recent input operation on fIchannelIdfR (such as fBgetsfR),
- 0 otherwise.
- .PP
- fIChannelIdfR must be an identifier for an open channel such as a
- Tcl standard channel (fBstdinfR, fBstdoutfR, or fBstderrfR),
- the return value from an invocation of fBopenfR or fBsocketfR, or
- the result of a channel creation command provided by a Tcl extension.
- .SH EXAMPLES
- Read and print out the contents of a file line-by-line:
- .CS
- set f [open somefile.txt]
- while {1} {
- set line [gets $f]
- if {[fBeoffR $f]} {
- close $f
- break
- }
- puts "Read line: $line"
- }
- .CE
- .PP
- Read and print out the contents of a file by fixed-size records:
- .CS
- set f [open somefile.dat]
- fconfigure $f -translation binary
- set recordSize 40
- while {1} {
- set record [read $f $recordSize]
- if {[fBeoffR $f]} {
- close $f
- break
- }
- puts "Read record: $record"
- }
- .CE
- .SH "SEE ALSO"
- file(n), open(n), close(n), fblocked(n), Tcl_StandardChannels(3)
- .SH KEYWORDS
- channel, end of file