digitalmars.D.bugs - OSX stream seek/read problem
- wade (24/24) Feb 25 2009 The following code behaves differently on OSX than LINUX (DMD 1.040):
- Kagamin (3/4) Feb 25 2009 May be related...
- Sean Kelly (2/2) Mar 30 2009 This will be fixed in DMD 2.027. I haven't looked into it for DMD1 yet
The following code behaves differently on OSX than LINUX (DMD 1.040): import std.stdio; import std.stream; import std.file; int Lines(Stream f) { int ln = 0; foreach (char[] line; f) ln++; return ln; } void main(char[][] args) { auto f = new BufferedFile(args[1]); int l = Lines(f); f.seek(0, SeekPos.Set); int r = Lines(f); fwritef(stderr, "Lines before: %d, Lines after: %d\n", l, r); } Results for OSX: Lines before: 1633, Lines after: 0 Results for LINUX Lines before: 1633, Lines after: 1633 Seek not working properly perhaps? wade
Feb 25 2009
wade Wrote:Seek not working properly perhaps?May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek
Feb 25 2009
Kagamin Wrote:wade Wrote:seems like phobos needs some error handling.Seek not working properly perhaps?May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek
Feb 25 2009
looks like a candidate. Probably a bug in phobos. Kagamin Wrote:Kagamin Wrote:wade Wrote:seems like phobos needs some error handling.Seek not working properly perhaps?May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek
Feb 25 2009
This will be fixed in DMD 2.027. I haven't looked into it for DMD1 yet though.
Mar 30 2009