Reading Non-tabular Numeric Values from a Text File à la Fortran's `read`

Actually that will be useful to me as well, so I would do it this way:

julia> lineparser( t :: Type, s :: String ) = parse.(t,split(s, c -> c <= ' ', keepempty=false))

julia> file = open("teste.dat","r")
IOStream(<file teste.dat>)

julia> lineparser(Int64,readline(file))
5-element Array{Int64,1}:
 1
 2
 3
 4
 5

julia> x2 = lineparser(Float64,readline(file))
2-element Array{Float64,1}:
 1.0
 2.0
1 Like