Rewritten read() using pointer