Re: char driver module prob.

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

 



On Tue, 2005-03-29 at 06:06 -0500, Gopu Bhaskar wrote:
> > > 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.
> 
yeah, i agree. but this was just a quick test thing i was
trying............so overlooked it!

--
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