+ // Copy the file contents into a std::stringstream
+ std::stringstream recent;
+ while (!feof (fin)) {
+ char buf[1024];
+ size_t charsRead = fread (buf, sizeof(char), 1024, fin);
+ if (ferror (fin)) {
+ error << string_compose (_("Error reading recent session file %1 (%2)"), path, strerror (errno)) << endmsg;
+ fclose(fin);
+ return -1;
+ }
+ if (charsRead == 0) {
+ break;
+ }
+ recent.write (buf, charsRead);
+ }
+