Read4
Read N Characters Given Read4
def read(self, buf, n):
idx = 0
buf4 = [''] * 4
while idx < n:
num = read4(buf4)
if num == 0:
break
i = 0
# 讀進來沒那麼多
while idx < n and i < num:
buf[idx] = buf4[i]
i+=1
idx+=1
return idxRead N Characters Given Read4 II
Last updated