Try this:

Qt Code:
  1. void Read(QString file_name)
  2. {
  3. QFile myfile(file_name);
  4. if(myfile.exists())
  5. {
  6. if(myfile.open(QIODevice::ReadOnly)){
  7. QTextStream stream(&myfile);
  8. QString my_buffer = stream.realAll();
  9. qDebug()<<my_buffer;
  10. myfile.close();
  11. }
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 

Using readAll() is not recommended unless you can assert that the size of the read files is not very large.