site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=kbVb/cfPl3OqIrSBdxeZyzpAK50RNzt3IvAIvWBoPSCbChOz6oVVLbEt3dX2j2bCtmFSOzGM7JJikmqhjpKPunyZ0otB2bQkCUNT0v7kEH5Y225APIlOgaRsT9rEu5UmHg0DKOW+PysM5fWk6C+MkGoVsNzIDiB+cTgfpmpY2E8= ; Hi all, I had recently posted a mail asking about the problems faced in dev_write of a character deive using uiomove.I am now able to print the data after doing the uiomove() opearation i,e print the data after copying from user space to kernel space. I have observed that uimove() api in the driver works only when u write a null terminated string from the user space application. How do i write a single character from user space application which is not null terminated?? write(device_fd, (char *)&c, 1); //doesnt work write(device_fd, str, strlen(str)); // works fine Here is the sample user space application through which i am writng to and reading from the driver. int main() { FILE *fp = NULL; int device_fd = -1; char str[50] = {0}; char file_name[40] = {0}; printf("Enter the file name\n"); scanf("%s", file_name); device_fd = open(dev_name, O_RDWR); fp = fopen(file_name, "r"); if (fp == NULL) { printf("File open failed\n"); return ; } //while ((c = fgetc(fp)) != EOF) // doesnt work while ((retval= fgets(str,sizeof(str),fp)) != NULL) { //ret = write(device_fd, (char *)&c, 1); // doesnt work ret = write(device_fd, str, 10); // works fine } } __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com