Re: char driver module prob.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > const char msg[] = "hello";
> >
> > static ssize_t Device_read(struct file *filp,char *buf,size_t
> > count,loff_t *offset)
> > {
> >         if (*offset >= sizeof(msg) )
> >         {
> >                 return 0;
> >         }
> >
> >         count = sizeof(msg);
> 
> Here's your error, that should be count = strlen(msg);

sizeif(msg) would give the size of the array msg. i.e. 6
Although the useage is not good, serves the purpose here.

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux