c++ 4 lines 0ms


  • -1
    Z

    int read(char *buf, int n) {
    char *cur_buf = buf;
    for (int count = 4; cur_buf - buf < n && count == 4; cur_buf += count)
    count = read4(cur_buf);
    *(cur_buf - max(0, (cur_buf - (buf + n)))) = '\0';
    return n;
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.