Ali Reza, while doing as you suggest (and dropping the std::endl) will make the code compile, it will still not do what the OP expects it to do. QDataStream is the wrong tool for the job of writing a text file... the output file will have these bytes written (using C-style escapes):
Qt Code:
  1. \0 \0 \0 \006 b b b b \n \0
To copy to clipboard, switch view to plain text mode 
That is, it is a ten-byte binary file rather than a five-byte (or six on Windows) text file.

Sonulohani, this will not help. The code will still fail to compile, just for different reasons.