DIY: Read N Characters Given Read4 II — Call Multiple Times
Understand how to implement a read function that reads n characters from a file by repeatedly using the read4 API. This lesson guides you through managing multiple calls to read, handling buffers, and simulating file reading constraints often seen in coding interviews.
We'll cover the following...
We'll cover the following...
Problem statement
Suppose that you can only read a given File using a specific API method called read4. You will implement the read method to read n characters from the File. This read method can be called multiple times.
read4() API:
The read4() API reads the next four consecutive characters from the File, until the File no longer has any characters that need to be read. After reading, the read4() method writes the ...