copy_to_user vs sprintf

From: Hagit (hagit_guy_at_hotmail.com)
Date: 01/28/04


Date: 28 Jan 2004 01:51:34 -0800

I just cant get it!
I wrote a module that created its own entry in the /proc file system.
My module implemented read and write functions. When the user call
read(fd, &buff, 1) I am trying to copy to the user buff the character
B. When I use the
copy_to_user() function, the user doesnt get my B, but when I use the
sprintf() function the user gets the B. I cant understand it. what is
wrong???
The relevant calls are described below:

char raed_info = 'B';

copy_to_user(page, &read_info, sizeof(read_info));

sprintf(page,"%c",read_info);

Thanks
Hagit



Relevant Pages

  • Re: copy_to_user vs sprintf
    ... > I wrote a module that created its own entry in the /proc file system. ... > sprintf() function the user gets the B. I cant understand it. ...
    (comp.os.linux.misc)
  • Re: copy_to_user vs sprintf
    ... > I wrote a module that created its own entry in the /proc file system. ... > sprintffunction the user gets the B. I cant understand it. ... Josef Möllers ...
    (comp.os.linux.development.system)
  • copy_to_user vs sprintf
    ... I just cant get it! ... I wrote a module that created its own entry in the /proc file system. ... readI am trying to copy to the user buff the character ...
    (comp.os.linux.development.apps)
  • copy_to_user vs sprintf
    ... I just cant get it! ... I wrote a module that created its own entry in the /proc file system. ... readI am trying to copy to the user buff the character ...
    (comp.os.linux.development.system)
  • copy_to_user vs sprintf
    ... I just cant get it! ... I wrote a module that created its own entry in the /proc file system. ... readI am trying to copy to the user buff the character ...
    (comp.os.linux.misc)