Qt World Summit: Submit your Presentation


How to Swap Data Between txt File



  • 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


  • Lifetime Qt Champion

    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


Log in to reply