Quote Originally Posted by jaca View Post
I have a binary file but I do not know what is written in it.
How do I read a binary file byte to byte and convert to String (QString)?
I do not know how this file is formatted, so it must convert this file to text.
Thanks.
Each binary file having a signature.... / QDataStream having a nummer (on my case!)

This function was introduced in Qt 4.1.

Qt Code:
  1. QIODevice::peek(4).contains("PNG"); /* pngimage */
  2. QIODevice::peek(4).contains("GIF"); /* gifimage */
  3. QIODevice::peek(4).contains("MZ"); /* executable */
  4.  
  5. QIODevice::peek(4).contains("<"); /* xml.xhtml, or xmldialect and open as text */
To copy to clipboard, switch view to plain text mode 



replace QIODevice by QFile or what else...