string reading function