updated chardev.c to use function pointer for sys_write system call