Writing to a file



  • 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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.