You could create your own:

julia> Base.readline(s, i::Int) = (for (j,line) in enumerate(eachline(s)); 
if j==i; return line; end; end; error("not enough lines"))
readline (generic function with 4 methods)

julia> f = open("/tmp/tmp.txt", "w")
IOStream(<file /tmp/tmp.txt>)

julia> for i in 1:20 write(f, "$i\n") end

julia> close(f)

julia> readline(open("/tmp/tmp.txt"), 15)
"15\n"

julia> readline(open("/tmp/tmp.txt"), 25)
ERROR: not enough lines
 in readline at none:1




On Tuesday, June 16, 2015 at 12:17:28 PM UTC-4, paul analyst wrote:
>
> If o is stream
> o=open(file)
>
> how to read any line  ?e.g. 15 
>
> julia> readline(o,15)
> ERROR: MethodError: `readline` has no method matching readline(::IOStream, 
> ::Int64)SYSTEM: show(lasterr) caused
>  error
>
> Paul
>

Reply via email to