ofstream means your program is outputting to that file. ifstream means your program is reading things from that file. In lines 21 and 22 you are telling the program to read the file. If the file is blank, it will stay blank no matter how many times you read it.