tell(3tcl) Tcl Built-In Commands tell(3tcl)__________________________________________________________________________________________________________________________________________________NAME
tell - Return current access position for an open channel
SYNOPSIS
tell channelId
_________________________________________________________________DESCRIPTION
Returns an integer string giving the current access position in channelId. This value returned is a byte offset that can be passed to seek
in order to set the channel to a particular position. Note that this value is in terms of bytes, not characters like read. The value
returned is -1 for channels that do not support seeking.
ChannelId must be an identifier for an open channel such as a Tcl standard channel (stdin, stdout, or stderr), the return value from an
invocation of open or socket, or the result of a channel creation command provided by a Tcl extension.
EXAMPLE
Read a line from a file channel only if it starts with foobar:
# Save the offset in case we need to undo the read...
set offset [tell $chan]
if {[read $chan 6] eq "foobar"} {
gets $chan line
} else {
set line {}
# Undo the read...
seek $chan $offset
}
SEE ALSO file(3tcl), open(3tcl), close(3tcl), gets(3tcl), seek(3tcl), Tcl_StandardChannels(3tcl)KEYWORDS
access position, channel, seeking
Tcl 8.1 tell(3tcl)
Check Out this Related Man Page
flush(3tcl) Tcl Built-In Commands flush(3tcl)__________________________________________________________________________________________________________________________________________________NAME
flush - Flush buffered output for a channel
SYNOPSIS
flush channelId
_________________________________________________________________DESCRIPTION
Flushes any output that has been buffered for channelId.
ChannelId must be an identifier for an open channel such as a Tcl standard channel (stdout or stderr), the return value from an invocation
of open or socket, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for writing.
If the channel is in blocking mode the command does not return until all the buffered output has been flushed to the channel. If the chan-
nel is in nonblocking mode, the command may return before all buffered output has been flushed; the remainder will be flushed in the back-
ground as fast as the underlying file or device is able to absorb it.
EXAMPLE
Prompt for the user to type some information in on the console:
puts -nonewline "Please type your name: "
flush stdout
gets stdin name
puts "Hello there, $name!"
SEE ALSO file(3tcl), open(3tcl), socket(3tcl), Tcl_StandardChannels(3tcl)KEYWORDS
blocking, buffer, channel, flush, nonblocking, output
Tcl 7.5 flush(3tcl)
# Create the simulator object that we need in order to run NS
set ns
# Set the parameters that we will use for wireless communications
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set... (0 Replies)
Hi Folks
I'm looking for help with if statement.
I'm reading the file with header (starts with 0 on position 1 in the line) and data (starts with 1 on position 1 in the line).
I have to check if the number from header (should be number of data rows) equal actual count of the data rows.
... (4 Replies)