2016-12-08 | Paul Boddie | file changeset files shortlog | Added support for closing files and streams. Made the low-level write operation return the number of bytes written, also declaring the IOError that can be raised. |
paul@341 | 1 | from posix import read |
paul@331 | 2 | |
paul@331 | 3 | try: |
paul@331 | 4 | s = read(3, 10) |
paul@331 | 5 | except IOError, exc: |
paul@331 | 6 | print "read(3, 10): input/output error condition", exc.value |
paul@331 | 7 | |
paul@331 | 8 | s = read(0, 10) |
paul@331 | 9 | print s |