title: to transmit and receive floating point using serial communication c++
body: <p>using WiringPi library for serial communication on Raspberrypi 
  the function serialPutchar(int fd, unsigned char c) and serialGetchar (int fd) works fine to send and receive integer value 
  but does not show floating points</p>
  
  <p>sender side</p>
  
  <pre><code>int main ()
  {
  int fd ;
  int count ;
  float val;
  
  if ((fd = serialOpen ("/dev/ttyAMA0", 9600)) &lt; 0)
  {
  fprintf (stderr, "Unable to open serial device: %s\n", strerror 
  (errno)) ;
  return 1 ;
  }
  
  if (wiringPiSetup () == -1)
  {
  fprintf (stdout, "Unable to start wiringPi: %s\n", strerror 
  (errno)) ;
  return 1 ;
  }
  for (count = 0 ; count &lt; 256 ; ){
  val=4.1;
  fflush (stdout) ;
  serialPutchar(fd,val);
  ++count ;
  delay (500) ;
  }
  printf ("\n");
  return 0;}
  </code></pre>
  
  <p>Receiver side</p>
  
  <pre><code> int main ()
   {
   int fd ;
  
   if ((fd = serialOpen ("/dev/ttyUSB0", 9600)) &lt; 0)
   {
  fprintf (stderr, "Unable to open serial device: %s\n", strerror 
  (errno)) ;
  return 1 ;
  }
  if (wiringPiSetup () == -1)
  {
  fprintf (stdout, "Unable to start wiringPi: %s\n", strerror 
  (errno)) ;
  return 1 ;
  }
  while(true)
  
  {
  
    printf ("%f", serialGetchar (fd)) ;
    fflush (stdout) ;
    printf ("\n") ;
  }
  
  return 0 ;
  }
  </code></pre>
  
  <p>i expected the output to be 4.100000 but the actual output is 0.000000</p>
  
  <p>Any help to send and receive floating point numbers will be appreciated
  Thanks in advance</p>