ABCs_LowLevelFileIO - answer in line1 Write your code here...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [fid1, line1, line2] = ABCs_LowLevelFileIO(file1, file2) % ABCs of Lower-Level File I/O % % This is a multi-part problem. Do each of the parts below. Note that % each input parameter, file1 and file2, will contain a string that is the % name of some file. These two files will be referred to as file1 and % file2 for the rest of this problem. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % % a) fopen(). Open file1 for read access. Store it's file identifier in a % variable called fid1. % % Write your code here: fid1 = fopen(file1,'r'); f % b) fgets(). Now read the first line of file1 using fgets(). Store your
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % answer in line1. % % Write your code here: line1 = fgets(fid1); l % c) fgetl(). Now read the second line of file1 using fgetl(). Store your % answer in line2. % % Write your code here: line2 = fgetl(fid1); l % d) fprintf(). Write line1 to file2. You will first need to open the file % with write access. % % Write your code here: fid1 = fopen(file2,'w'); fprintf(file2,line1); f % e) fclose(). Use fclose() to close both file1 and file2. Do NOT use % fclose all. % % Write your code here: fclose(fid1);...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online