A
Abirami Selvam
Hi,
Should we close the file after reading it?
Please see the code below...
data = IO.readlines("test.txt","r")
diskfile = File.open("test.xml","w+")
data.each do |line|
line.chomp!
diskfile.puts(line) if line.length>0
end
It is working fine, even without closing the file(diskfile.close). Can
someone suggest me. Does the file close automatically or not?
Thanks in advance
Abirami
Should we close the file after reading it?
Please see the code below...
data = IO.readlines("test.txt","r")
diskfile = File.open("test.xml","w+")
data.each do |line|
line.chomp!
diskfile.puts(line) if line.length>0
end
It is working fine, even without closing the file(diskfile.close). Can
someone suggest me. Does the file close automatically or not?
Thanks in advance
Abirami