- 论坛徽章:
- 8
|
如果你想puts在gets之后,直接 seek $f 0 current 试试
另外这是不是个bug是没必要讨论的,tcl的open/puts/gets是建立在系统调用的基础上的,在俺的机器上man fopen 中有这样的一段
Reads and writes may be intermixed on read/write streams in any order.
Note that ANSI C requires that a file positioning function intervene
between output and input, unless an input operation encounters end-of-
file. (If this condition is not met, then a read is allowed to return
the result of writes other than the most recent.) Therefore it is
good practice (and indeed sometimes necessary under Linux) to put an
fseek or fgetpos operation between write and read operations on such a
stream. This operation may be an apparent no-op (as in fseek(..., 0L,
SEEK_CUR) called for its synchronizing side effect. |
|