I have a text file named data.txt having various parameters such as number, status and so on. Each line contains a different set of data.
Now, in my GUI, I have submit button. On click of that button, I want 'few' of these data to be displayed as a table on the GUI screen
One thing is I do know which position it exists in the text file :
Ex: Status appears at position [70..78] in each line of text file Number appears at position [85..90] in each line of text file and so on
I want only those particular parts of data to be displayed in respective columns of the table
Any suggestions would be welcome. I am using Qt and Ruby for my GUI design
Following images show what exactly i am looking for:
EDIT: Using the solution mentioned by Stephen:
Using the line position worked for me. But one query here, when i try to use that using puts statement, it does print properly. However when i try to use the same for displaying it inside TextEdit widget, each line does not get displayed..
@text_var = "#{line[70..78]}\t#{line[85..90]}
@text = Qt::TextEdit.new(self)
@text.setText (@text_var)
puts @text_var
Puts statement gives correct output, however i am not able to send the same inside the widget. If i use break statement , then first line is getting displayed in widget correctly. So error is happening when it is trying to read line by line on to the widget. Ultimately, it is getting overwritten and last line where just blank spaces are there is getting printed in the widget i feel.
Any solutions for this ?