karpathy/neuraltalk2

read 0 blocks instead of 1 at /export/home/jkhurana/torch/pkg/torch/lib/TH/THDiskFile.c:563

jKhurana opened this issue · 1 comments

I was trying to read a file with readSting() method. Below is my code

require 'torch'
require 'pl'

local f = torch.DiskFile('train')
f:clearError()
local rawdata = f:readString('*l')
while (not f:hasError()) do
	print(rawdata)
	rawdata = f:readString('*l')
end

First it reads all the lines of file and at last gives the following error
read 0 blocks instead of 1 at /export/home/jkhurana/torch/pkg/torch/lib/TH/THDiskFile.c:563

I can not use io.read() as I have to serialise the content later.

Problem is solved. My file was not in quite() mode.