Important: Please read the Qt Code of Conduct -

File reader if something is updated in file

  • Dear Friends,
    can someone help me.
    If I am reading xml file and if something is written or edited .then how can i get that node from where the file is updated.I want to escape from that idea so again it will start from beginning to read that file.I want that i should start reading from that node where it is updated or written something in my file.Please give some ideas

    thanks guys

  • Moderators

    You need to either remember the line where the tag lies in the file, or store both versions and run diff between them to get the changed lines.

  • thanks for replying,
    If I will store both the version then for comparing them we again need to read both the Agin that problem will come .I want to go that line without reading the whole file.
    May be I am not getting something.Can you give some example.or any other idea.

  • Moderators

    So use the first option: remember the line. You don't control the IO in the operating system, so you can't "just know" what has been changed.

    And in most cases, reading a file is not a problem: it will take just a few milliseconds. Same with running "diff": it will read both files, true, but it will return all the changes that have been made, and it will do it quickly (git is able to diff between thousands of files in less than a second...).

Log in to reply