How is it better to implement writing to QFile in reverse order, string by string.
With use of seek(0) new string is written over old one.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should use a
QStackof QString. Since it’s a LIFO (Last In First Out) container I think it’s what you are searching for.Push each string as they come and then pop all strings:
Edit: (new information in comments concerning the 2 files to write)
Use a
Qvectorto store all QString. Then in a for loop access first and last element to write them in each file. This can be done like this:Hope that answers your question.