Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Strange unpredictable file interpretation by Qt Creator?

    General and Desktop
    3
    10
    3294
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jleloux last edited by

      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

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

        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?

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • J
          jleloux last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • E
            Eddy last edited by

            Hi Jonathan,

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

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply Reply Quote 0
            • T
              tobias.hunger last edited by

              How about filing a "bug report":http://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.

              1 Reply Last reply Reply Quote 0
              • J
                jleloux last edited by

                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):

                @FILE *infile, *outfile;
                infile = fopen(inFileName_.c_str( ), "r");
                if (infile == NULL)
                {
                printf("Failed to open file: %s\n", inFileName_.c_str( ));
                return 1;
                }

                    outfile = fopen(outFileName_.c_str( ), "w");
                
                    if (outfile!=NULL)
                    {
                
                    for (unsigned int j = 0; j < outputVariables_.size(); j++)
                    {
                        //printf("- ", outputVariables_[ j ]);
                        switch ( outputVariables_[ j ] )
                        {
                            case 1:
                                fprintf(outfile, "   ID ");
                                break;
                            case 2:
                                fprintf(outfile, "           t_mfe ");
                                break;
                

                more of the same cases here

                        }
                    }
                    fprintf(outfile,"\n");
                

                while (feof(infile) == 0)
                {

                if (feof(infile) == 0)
                {
                for (unsigned int j = 0; j < outputVariables_.size(); j++)
                {
                //printf("- ", outputVariables_[ j ]);
                switch ( outputVariables_[ j ] )
                {
                case 1:
                //printf("%5ld ", satrec.satnum);
                fprintf(outfile, "%5ld ", satrec.satnum);
                break;
                case 2:
                fprintf(outfile, ".8f ", tsince);
                break;
                more of the same cases here

                                            }
                                        }
                                        fprintf(outfile,"\n");
                

                }
                }
                @

                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

                1 Reply Last reply Reply Quote 0
                • E
                  Eddy last edited by

                  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)

                  Qt Certified Specialist
                  www.edalsolutions.be

                  1 Reply Last reply Reply Quote 0
                  • J
                    jleloux last edited by

                    QTCREATORBUG-5690

                    Thx.

                    :)

                    1 Reply Last reply Reply Quote 0
                    • E
                      Eddy last edited by

                      Thanks Jonatan,

                      Here is the answer about this issue from the Trolls:

                      bq. 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.

                      Qt Certified Specialist
                      www.edalsolutions.be

                      1 Reply Last reply Reply Quote 0
                      • J
                        jleloux last edited by

                        Noticed.

                        Indeed. :)

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post