sBasic/s_basic/util/io.py

19 lines
342 B
Python

"""
This module provides utility functions and classed for I/O.
"""
class CharacterDevice(object):
def __init__(self, file_):
self._file = file_
def getc(self):
return self._file.read(1)
def ungetc(self, c):
self._file.seek(-1, 1)
def ungets(self, s):
self._file.seel(-len(s), 1)
def close(self):
return self._file.close()