Files and Directories
Exercise: Reading from a file
Goal
Read from the local file Movies.txt
- Create a file stream called file using the local file "Movies.txt"
- Create a stream reader called reader using the file stream
- While we are not at the end of the stream, create a local string declaration named movie and assign this the value of the next line from the file
- Write each movie to the Console using WriteLine.
- After the loop close the reader
Page 11 of 20