%% Read to End of File
% From this badpoem.txt file, read one line at a time to the end of the file.
%
%
% Use fopen to open the file. This function assigns a unique file id to use for reading and writing to the file.

fid = fopen('badpoem.txt');

% Read and display one line at a time until you reach the end of the file.

while ~feof(fid)
    tline = fgetl(fid);
    disp(tline)
end

% Close the file.

fclose(fid);

% Copyright 2012 The MathWorks, Inc.