July 28, 2011

jleloux jleloux
Lab Rat
5 posts

Strange unpredictable file interpretation by Qt Creator?

 

Dear All,

I have been using Qt creator for half a year now without any problems but yesterday/today i struck a very strange problem:

I generated some .txt files with my code but when I open them in Qt Creator they sometimes show up in the right way bu some other times in a strange way, a little bit like the layout of the debug .O files in a project.
Even when I run the same code different instances with the same or different filenames as output, the output file is sometimes shown in the right manner and sometimes not.
Sometimes Qt creator also crashes unexpectedly with a runtime error when the file is open.

When I open the ‘strange’ files in notepad or wordpad they seem fine though! :S

Screenshot of the file opened in qt creator and notepad at the same time:

http://i56.tinypic.com/34ra82r.png

If you could help me this would be greatly appreciated.

Thanks in advance,

Best regards,

Jonatan

9 replies

July 28, 2011

Eddy Eddy
Gene Splicer
1296 posts

Could you post a sample file, so we can have a look at it?

Also, how did you write to it. Can you show us some code?

 Signature 

Qt Certified Specialist
Qt Ambassador

July 28, 2011

jleloux jleloux
Lab Rat
5 posts

Sample file is 90 MB and code is large.
I will try to post it tomorrow, I’ll see if i can generate a smaller file with the same problem then.
And I’ll add parts of the code then as well.

July 28, 2011

Eddy Eddy
Gene Splicer
1296 posts

Hi Jonathan,

You don’t have to post everything. A small file and only the relevant code where you write the file is enough.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 29, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3224 posts

How about filing a bug report [bugreports.qt.nokia.com] for the misdetection?

Bug reports are actually used to allocate developer time, so having them drastically increases the chances of somebody looking into an issue.

July 29, 2011

jleloux jleloux
Lab Rat
5 posts

The strange thing is that it now only happens when i set my time step to about 1.0, which creates the large file.
For a time step op 10.0 it does not happen.
Only if I rewrite the previous file which was 10.0 with a 1.0, the file updates as strange, but when I reopen it, it has dissapeared.
Also when I copy part of the weird file which show right in notepad to a new notepad document and open it in qt then it shows up normal again.

I uploaded the strange file to we transfer with the following link:
http://wtrns.fr/j0afjeOZJi71Qk

Parts of the code which deal with file reading and writing (I left out a lot of code in between brackets):

  1. FILE *infile, *outfile;
  2. infile = fopen(inFileName_.c_str( ), "r");
  3.         if (infile == NULL)
  4.    {
  5.             printf("Failed to open file: %s\n", inFileName_.c_str( ));
  6.      return 1;
  7.    }
  8.  
  9.         outfile = fopen(outFileName_.c_str( ), "w");
  10.  
  11.         if (outfile!=NULL)
  12.         {
  13.  
  14.         for (unsigned int j = 0; j < outputVariables_.size(); j++)
  15.         {
  16.             //printf("- ", outputVariables_[ j ]);
  17.             switch ( outputVariables_[ j ] )
  18.             {
  19.                 case 1:
  20.                     fprintf(outfile, "   ID ");
  21.                     break;
  22.                 case 2:
  23.                     fprintf(outfile, "           t_mfe ");
  24.                     break;
  25.              
  26. more of the same cases here
  27.  
  28.  
  29.             }
  30.         }
  31.         fprintf(outfile,"\n");
  32.  
  33. while (feof(infile) == 0)
  34.           {
  35.  
  36. if (feof(infile) == 0)
  37. {
  38. for (unsigned int j = 0; j < outputVariables_.size(); j++)
  39.                             {
  40.                                 //printf("- ", outputVariables_[ j ]);
  41.                                 switch ( outputVariables_[ j ] )
  42.                                 {
  43.                                     case 1:
  44.                                         //printf("%5ld ", satrec.satnum);
  45.                                         fprintf(outfile, "%5ld ", satrec.satnum);
  46.                                         break;
  47.                                     case 2:
  48.                                         fprintf(outfile, ".8f ", tsince);
  49.                                         break;
  50.                                     more of the same cases here
  51.  
  52.  
  53.                                 }
  54.                             }
  55.                             fprintf(outfile,"\n");
  56. }
  57. }

I created it in this way so that I can manually enter which variables I want in what order for the output.
First it prints a header with the variables names, after which a tabulated list of the values follow.

Thanks,

Jonatan

July 29, 2011

Eddy Eddy
Gene Splicer
1296 posts

Hi, jonatan,

Tobias suggested to make a bugreport out of it. That way you get special attention by our beloved Trolls(= nickname for the Qt developers)

Filing a bug report is easy just go to the bugtracker and describe your problem(you can use what you have written already)

Don’t forget to add a link to this topic. And copy the bug number here(something like QTBUG-345)

 Signature 

Qt Certified Specialist
Qt Ambassador

August 1, 2011

jleloux jleloux
Lab Rat
5 posts

QTCREATORBUG-5690

Thx.

:)

August 1, 2011

Eddy Eddy
Gene Splicer
1296 posts

Thanks Jonatan,

Here is the answer about this issue from the Trolls:

Currently Creator doesn’t handle too large files (greater than 48MB approx). In such cases, it switches to the binary editor, which is the one you see.

I thought this could be interesting for other Qt enthousiasts so I put it here too.

 Signature 

Qt Certified Specialist
Qt Ambassador

August 1, 2011

jleloux jleloux
Lab Rat
5 posts

Noticed.

Indeed. :)

 
  ‹‹ discussion about threads, moveToThread etc.      disable standard button within QDialogButtonBox ››

You must log in to post a reply. Not a member yet? Register here!