The code below works perfectly, cheers!

Qt Code:
  1. file.resize(0);
To copy to clipboard, switch view to plain text mode