Hi All,

In below piece of code, I am trying to read the size of a binary file in bytes and assign it to a variable of type uint16_t.
Qt Code:
  1. QFile f (fileName);
  2. uint16_t readSize;
  3.  
  4. f.open (QIODevice::ReadOnly);
  5. qDebug()<<"size of a binary file "<<fileName<< "is in bytes"<<f.size ()<<"\n"; ===> 131071 (expected value)
  6.  
  7. readSize = f.size ();
  8. qDebug()<<"size of a binary file "<<readSize<<"\n";====> 65535 (Incorrect value)
  9.  
  10. /* updating file size to a struct variable of type uint16_t
  11. req.Size = f.size ();====> 65535 (Incorrect value)
To copy to clipboard, switch view to plain text mode 

When I change readSize data type from int then
Qt Code:
  1. readSize = f.size ();
  2. qDebug()<<"size of a binary file "<<readSize<<"\n";====> 131071
To copy to clipboard, switch view to plain text mode 

Is this because of data type uint16_t restricting? or size of the file exceeding the range of uint16_t?