sprintf not working in char driver module
Howdy,
I'm writing a character driver and am getting some wierd behavior from the command sprintf. Here is the basic code.
----------------------------------------------------------------------
ssize_t driver_read (struct file *filp, char *buf, size_t count, loff_t *ppos) {
int bytes = 0;
char output[256];
int myint = 12;
float myfloat = 1.234567;
bytes = sprintf(output, "int = %i float = %f \n", myint, myfloat);
copy_user (buf, &output, bytes);
return bytes;
}
-----------------------------------------------------------------------
The output to this is
int = 12 float = %f
Does anyone know why floats are not working for sprintf?
cheers
Rich
|