Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Writing to a file
Forum Updated to NodeBB v4.3 + New Features

Writing to a file

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    pushpa416
    wrote on last edited by
    #1

    Hi,

    I am reading a txt file and comparing the values, and I want to substract max and min values and output all the values in a txt file or display on the screen when I push the button. please find the code below for comaprision

    @
    for (row = 0; row < 550; row++){
    QByteArray line = file.readLine();
    QList<QByteArray> numbers = line.split(',');
    for (column = 0; column < numbers.size(); column++) {
    data = numbers[column].toInt();
    if (data > max[column])
    max[column] = data;

                if (data < min[column])
                    min[column] = data;
            }
    

    result = (max[column] - min[column]);
    }
    @

    and the ouput is like output of the result[row][column]
    @
    row =1
    column=200000
    @

    It works perfectly fine for comparision and subtraction, I can output each column output separately but I want to output array[columns], subtracted values at once, I stuck there

    any suggestions would be appreciated

    thanks

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      I don't understand what do you want do.

      at line 12 'result' is computed once per row with column equals to numbers.size() +1

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved