How it works...
The first file name that is passed through the command-line arguments is opened in read-only mode. The second file name that is passed through the command-line arguments is opened in write-only mode. If both files are opened correctly, then the fp and fq pointers , respectively, will point at the read-only and write-only files.
We will set a while loop to execute until it reaches the end of the source file. Within the loop, one line from the source file will be read using the fgets function. The fgets function reads the specified number of bytes from the file or until the new line character, \n, is reached. If the new line character does not appear in the file, then the BUFFSIZE constant limits the bytes to be read from the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access