Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Operation IO on files
Qt 6.11 is out! See what's new in the release blog

Operation IO on files

Scheduled Pinned Locked Moved General and Desktop
9 Posts 5 Posters 4.5k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    tczaude
    wrote on last edited by
    #1

    I have problem i read from file that
    @//Odzczyt pliku

    QFile file_2("D:\\Prosit\\veryf.txt");
    

    // QFile file_2("veryf.txt");
    if (!file_2.open(QIODevice::ReadOnly | QIODevice::Text))
    return;

    QTextStream in(&file_2);
    while (!in.atEnd()) {
    QString zm_ver = in.readLine();
    ui->line_veryf->setText(zm_ver);
    
    file_2.close();
    QFile::remove("D:\\Prosit\\veryf.txt");
    

    @

    And on Win7 all is working
    On one XP working without full path (comment)
    On second Xp dont working with full path or without full path

    Someone have any idea
    Thanks for help

    Tomasz Czauderna
    tczaude@gmail.com
    e-salamandra.pl

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Welcome to this forum

      Without knowing the file structures on your PCs it is difficult to give a proper answer.

      However, the first suggestions would be to check the existence of the files.
      The D drive is usually not on all systems.
      How about the directory?
      Is the file present, where you assume it should be?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tczaude
        wrote on last edited by
        #3

        file structures is on 100 % procent is ok.
        On one computer when i run from QT (debug or realese) is working if i run exe file from another place on this komputer is dosn't work.
        File is i sure is exist becouse now i make it manual by notepad.

        Tomasz Czauderna
        tczaude@gmail.com
        e-salamandra.pl

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          Qt always uses '/' as a path separator for filenames, but that should not effect your code.

          Have you tried using QFile's error(...) method to find out why the open failed?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tucnak
            wrote on last edited by
            #5

            Have you tried using QFile’s error(…) method to find out why the open failed?

            I am totally agree with Tobias. Qt extends many debug tools. You can use QFile errors as example.

            Good luck!

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tczaude
              wrote on last edited by
              #6

              Problem is exist with amplication which have trigers on catalog. I make bat file and add to triger which copy files to another folder and i read and all is ok. This strange becouse if I use anothers programs i try with OpenOffice make some docs read write and all is worked...
              Is exist any other mechanism to operations on files in QT ??
              This is problem if which can give some problems with programs like antivirus

              Tomasz Czauderna
              tczaude@gmail.com
              e-salamandra.pl

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #7

                So what is the error QFile reports? That should give a good hint as to what is causing the issue.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fluca1978
                  wrote on last edited by
                  #8

                  [quote author="tczaude" date="1320312689"]On second Xp dont working with full path or without full path

                  [/quote]

                  Check permissions.
                  Check directory tree.
                  Check drive letters.

                  report some concrete error (use qdebug, qfile::error and so on).

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tczaude
                    wrote on last edited by
                    #9

                    Problem is Solved DOS use / not \ and i must do when i run program go to root directory by cd...
                    I make bat file which have cd c:\ and run program and problem is not exist

                    Thanks everybody

                    Tomasz Czauderna
                    tczaude@gmail.com
                    e-salamandra.pl

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved