ruby - Qt : Reading the text file and Displaying in LineEdit -


i have input file , batch file. when batch file executed using system command, corresponding outfile generated.

now want particular text (position 350 357) outfile displayed on lineedit widget

here part of code:

 system("c:/org_class0178.bat") 

now outfile generated

 file.open("c:/org_class0178_out.txt", 'r').each |line|     var = line[350..357]     puts var    

# test whether file being read.

    @responselineedit = qt::lineedit.new(self)     @responselineedit.setfont qt::font.new("times new roman", 12)     @responselineedit.resize 100,20     @responselineedit.move 210,395      @responselineedit.settext("#{var}")  end  

when test whether file being read using puts statement, exact required output in editor. however, same text not being displayed on lineedit. suggestions welcome.

edit: wired observation here. works fine when try read input file , display , not work output file. puts statement give answer in editor confirming output file contain required text. confused on scenario.

there nothing wrong code fragments shown.

note var local variable. second , third code fragments in same context? if in same method, , var not touched in-between, work.

if fragments belong different methods of same class, instance variable (@var) solve problem.

if not help, use pry chase problem. follow link find pre-requisites , how use. place binding.pry in code, , program stop @ line. inspect variables doing.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -