www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14861] New: Error in stdio.d in LockingTextReader.readFront()


          Issue ID: 14861
           Summary: Error in stdio.d in LockingTextReader.readFront()
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: mgw yandex.ru

This mistake, is result of wrong algorithm with reading from the ring buffer of
the file and return of the read symbols there in stdio function ungetc().

This example doesn't work!

// dmd 2.067.1 Win 32
import std.stdio;

void main(string[] args) {
    File fw = File("panic.csv", "w");
    for(int i; i != 5000; i++) fw.writeln(i, ";",
    // Test read
    File fr = File("panic.csv", "r");
    int nom; string fam, nam, ot;
    // Error format read
    while(!fr.eof) fr.readf("%s;%s;%s;%s\n", &nom, &fam, &nam, &ot);

Aug 01 2015