TP with file IO (contains errors!!!!)