Qt Forum

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

    How to Swap Data Between txt File

    General and Desktop
    2
    2
    531
    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.
    • R
      Raminlich last edited by

      hi all
      i like to know is there any class for example do this:
      we have two txt file with names 1 , 2.

      1:
      hi
      yes

      2:
      goodbye
      no

      now in want swap this Data to be like this:
      1:
      goodbye
      no

      2:
      hi
      yes
      thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        No there's nothing pre-built for that. You'll have to open your files with QFile, parse their content e.g. to a QStringList, move things around, join back as a string and then overwrite the original data.

        There might be other solutions though

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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