Bug introduced in 10.0 and fixed in 10.3.0

Create a file temp.txt with the following content:


Treating the semicolon sequence as terminator, try to repeatedly read to the first terminator.

Table[ReadString["temp.txt", "\n;;;"], 6]

Contrary to my intent, this does not create a list holding "test1" 6 times. Instead, it keeps reading the file to the next terminator, and starts over when it reached the end-of-file.

  1. How can I understand the documentation to imply this behavior?
  2. Is there a stream object hiding somewhere? (It is not listed by Streams[].) If so, can it be closed?
  3. How can I most simply achieve the desired behavior? (Most simply means something more aesthetic than the following.)


Table[x = ReadString["C:/temp/temp.txt", ";;;"]; 
  ReadString["C:/temp/temp.txt"]; StringTrim[x], 6]
  • $\begingroup$ which version are you seeing this with? For me with 10.3.0 on Windows 7 it gives 6 times "test1" as expected (well it gives me "test1\r" but that's no surprise as I created the file on windows...) $\endgroup$ – Albert Retey Jan 23 '16 at 22:04
  • $\begingroup$ "10.2.0 for Microsoft Windows (64-bit) (July 7, 2015)" $\endgroup$ – Alan Jan 23 '16 at 23:36
  • 4
    $\begingroup$ I have the same problem in 10.1.0. Since the behavior was changed in 10.3.0 perhaps this is a bug and should be tagged as such? $\endgroup$ – Mr.Wizard Jan 24 '16 at 3:14
  • 2
    $\begingroup$ I can confirm that the behavior with 10.2.0, 10.1.0 and 10.0.2 (ReadList was new in v10 I think) is as Alan describes while it is as he expects in 10.3.0, both on the same Windows 7 (64bit) machine. So it looks like it is a bug which has been corrected for 10.3. $\endgroup$ – Albert Retey Jan 24 '16 at 17:25
  • $\begingroup$ @Mr.Wizard I can confirm that in 10.3 the behaviour is as Albert describes. I have added the bugs tag. $\endgroup$ – Jacob Akkerboom Feb 27 '16 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.