Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7567233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:36:51+00:00 2026-05-30T14:36:51+00:00

How is it better to implement writing to QFile in reverse order, string by

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:36:52+00:00Added an answer on May 30, 2026 at 2:36 pm

    You should use a QStack of 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:

    QStack<QString> stack;
    stack.push("first string");
    stack.push("second string");
    stack.push("third string");
    
    while (!stack.isEmpty())
    {
       QString string = stack.pop();
    }
    

    Edit: (new information in comments concerning the 2 files to write)

    Use a Qvector to 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:

    QVector<QString> vector;
    vector.append("first string");
    vector.append("second string");
    vector.append("third string");
    
    int size = vector.size();
    for (int i=0; i<size; i++)
    {
       QString string1 = vector[0]; // write it in one file
       Qstring string2 = vector[size-1-i]; // write it in another file
    }
    

    Hope that answers your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Or better said: When to use array as a field data type in a
Is better to use the below statement Convert.ToInt32(0 + stringValue) If not then why?
Which class design is better and why? public class User { public String UserName;
Which is better? Or use and OR mapper with SP's? If you have a
I'm writing a web app using python with web.py, and I want to implement
I'm writing a simple game with javascript/html5, and I'm trying to implement gravity. The
I'm writing a web app similar to wtfimages.com in that one visitor should never
I'm writing an interface that requires classes to implement a clone() method. My naive
I'm writing a Java game and I want to implement a power meter for
I'm writing a small shell script that needs to reverse the lines of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.