Overview
| Artifact ID: | 1c40741780efd47a3fdec8eb65012a9a556548da |
|---|---|
| Ticket: | 2176669fffffffffffffffffffffffffffffffff
Strange seek bug |
| User & Date: | ferrieux on 2009-11-22 06:04:02 |
Changes
- icomment:
Looking in detail at your example, I'm a bit surprised by yet another effect of this internal I/O conflict: after the 1-byte [puts], if we ask [tell] (which your example doesn't do), we get 1 of course. But then, at script level, how do we explain the fact that the subsequent [read] starts from the beginning of the file ? In other words, if we forget about the underlying OS file position and concentrate on the only Tcl-visible thing which is what [tell/seek] manipulate, it seems only logical to assume it is *both* a read and write pointer (otherwise we'd need extra API to separate them). Then after writing one byte we're at position 1, and the subsequent [read 2] should read from that position, and hence return the 2nd and 3rd byte of the file ("0a" here). Of course the implication of such a semantics is that a read might incur a flush (otherwise costly overlap computations are needed). So what ? Apart from the POTENTIAL INCOMPATIBILITY, what's wrong with such a simplified "Tcl r/w file pointer" concept ? - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"