added functions for file reading

from txttools repo