pointer write function