Skip to content

readdlm cannot read only part of a stream #10

Open
@krcools

Description

The following code

s = """
1 2 3
4 5 6
start_other_section
"""

d = readdlm(IOBuffer(s), Int; dims=(2,3))

Results in an error being thrown:

ERROR: at row 4, column 1 : ErrorException("file entry \"start_other_section\" 
cannot be converted to Int64")) in error at error.jl:21

I assume this is being caused by readdlm continuing to read the stream beyond the declared dimensions of the array. Surely this can't be the intended behavior of readdlm with array dimensions specified. The situation above is quite common, e.g. in mesh file formats where there typically is a section containing vertices and one containing cells or faces.

This example was created using:

Julia Version 0.4.5
Commit 2ac304d (2016-03-18 00:58 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    I/ObugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions