If a program is to read data from a file, an i stream must be declared and initialized as a connection between the program and the file. If it is to write data to a file, an of stream must be declared and initialized as a connection between the program and the file.